1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
system_gateway_groups.php
|
5
|
part of pfSense (http://pfsense.com)
|
6
|
|
7
|
Copyright (C) 2007 Seth Mos <seth.mos@xs4all.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
|
|
47
|
if (!is_array($config['gateways']['gateway_group']))
|
48
|
$config['gateways']['gateway_group'] = array();
|
49
|
|
50
|
$a_gateway_groups = &$config['gateways']['gateway_group'];
|
51
|
$a_gateways = &$config['gateways']['gateway_item'];
|
52
|
$changedesc = gettext("Gateway Groups") . ": ";
|
53
|
|
54
|
if ($_POST) {
|
55
|
|
56
|
$pconfig = $_POST;
|
57
|
|
58
|
if ($_POST['apply']) {
|
59
|
|
60
|
$retval = 0;
|
61
|
|
62
|
$retval = system_routing_configure();
|
63
|
$retval |= filter_configure();
|
64
|
/* reconfigure our gateway monitor */
|
65
|
setup_gateways_monitor();
|
66
|
|
67
|
$savemsg = get_std_save_message($retval);
|
68
|
if ($retval == 0)
|
69
|
clear_subsystem_dirty('staticroutes');
|
70
|
}
|
71
|
}
|
72
|
|
73
|
if ($_GET['act'] == "del") {
|
74
|
if ($a_gateway_groups[$_GET['id']]) {
|
75
|
$changedesc .= gettext("removed gateway group") . " {$_GET['id']}";
|
76
|
foreach ($config['filter']['rule'] as $idx => $rule) {
|
77
|
if ($rule['gateway'] == $a_gateway_groups[$_GET['id']]['name'])
|
78
|
unset($config['filter']['rule'][$idx]['gateway']);
|
79
|
}
|
80
|
unset($a_gateway_groups[$_GET['id']]);
|
81
|
write_config($changedesc);
|
82
|
mark_subsystem_dirty('staticroutes');
|
83
|
header("Location: system_gateway_groups.php");
|
84
|
exit;
|
85
|
}
|
86
|
}
|
87
|
|
88
|
$pgtitle = array(gettext("System"),gettext("Gateway Groups"));
|
89
|
$statusurl = "status_gateway_groups.php";
|
90
|
|
91
|
include("head.inc");
|
92
|
|
93
|
?>
|
94
|
|
95
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
96
|
<?php include("fbegin.inc"); ?>
|
97
|
<form action="system_gateway_groups.php" method="post">
|
98
|
<input type="hidden" name="y1" value="1">
|
99
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
100
|
<?php if (is_subsystem_dirty('staticroutes')): ?><p>
|
101
|
<?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>
|
102
|
<?php endif; ?>
|
103
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
104
|
<tr>
|
105
|
<td>
|
106
|
<?php
|
107
|
$tab_array = array();
|
108
|
$tab_array[0] = array(gettext("Gateways"), false, "system_gateways.php");
|
109
|
$tab_array[1] = array(gettext("Routes"), false, "system_routes.php");
|
110
|
$tab_array[2] = array(gettext("Groups"), true, "system_gateway_groups.php");
|
111
|
display_top_tabs($tab_array);
|
112
|
?>
|
113
|
</td></tr>
|
114
|
<tr>
|
115
|
<td>
|
116
|
<div id="mainarea">
|
117
|
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
|
118
|
<tr>
|
119
|
<td width="15%" class="listhdrr"><?=gettext("Group Name");?></td>
|
120
|
<td width="15%" class="listhdrr"><?=gettext("Gateways");?></td>
|
121
|
<td width="20%" class="listhdrr"><?=gettext("Priority");?></td>
|
122
|
<td width="30%" class="listhdr"><?=gettext("Description");?></td>
|
123
|
<td width="10%" class="list">
|
124
|
<table border="0" cellspacing="0" cellpadding="1">
|
125
|
<tr>
|
126
|
<td width="17"></td>
|
127
|
<td><a href="system_gateway_groups_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
|
128
|
</tr>
|
129
|
</table>
|
130
|
</td>
|
131
|
</tr>
|
132
|
<?php $i = 0; foreach ($a_gateway_groups as $gateway_group): ?>
|
133
|
<tr>
|
134
|
<td class="listlr" ondblclick="document.location='system_gateway_groups_edit.php?id=<?=$i;?>';">
|
135
|
<?php
|
136
|
echo $gateway_group['name'];
|
137
|
?>
|
138
|
|
139
|
</td>
|
140
|
<td class="listr" ondblclick="document.location='system_gateway_groups_edit.php?id=<?=$i;?>';">
|
141
|
<?php
|
142
|
foreach($gateway_group['item'] as $item) {
|
143
|
$itemsplit = explode("|", $item);
|
144
|
echo htmlspecialchars(strtoupper($itemsplit[0])) . "<br/>\n";
|
145
|
}
|
146
|
?>
|
147
|
</td>
|
148
|
<td class="listr" ondblclick="document.location='system_gateway_groups_edit.php?id=<?=$i;?>';">
|
149
|
<?php
|
150
|
foreach($gateway_group['item'] as $item) {
|
151
|
$itemsplit = explode("|", $item);
|
152
|
echo "Tier ". htmlspecialchars($itemsplit[1]) . "<br/>\n";
|
153
|
}
|
154
|
?>
|
155
|
</td>
|
156
|
<td class="listbg" ondblclick="document.location='system_gateway_groups_edit.php?id=<?=$i;?>';">
|
157
|
<?=htmlspecialchars($gateway_group['descr']);?>
|
158
|
</td>
|
159
|
<td valign="middle" nowrap class="list">
|
160
|
<table border="0" cellspacing="0" cellpadding="1">
|
161
|
<tr>
|
162
|
<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"></a>
|
163
|
<td><a href="system_gateway_groups.php?act=del&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"></a></td>
|
164
|
</tr>
|
165
|
<tr>
|
166
|
<td width="17"></td>
|
167
|
<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"></a></td>
|
168
|
</tr>
|
169
|
</table>
|
170
|
|
171
|
</tr>
|
172
|
<?php $i++; endforeach; ?>
|
173
|
<tr>
|
174
|
<td class="list" colspan="4"></td>
|
175
|
<td class="list">
|
176
|
<table border="0" cellspacing="0" cellpadding="1">
|
177
|
<tr>
|
178
|
<td width="17"></td>
|
179
|
<td><a href="system_gateway_groups_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
|
180
|
</tr>
|
181
|
</table>
|
182
|
</td>
|
183
|
</tr>
|
184
|
</table>
|
185
|
</div>
|
186
|
</td>
|
187
|
</tr>
|
188
|
</table>
|
189
|
</form>
|
190
|
<?php include("fend.inc"); ?>
|
191
|
</body>
|
192
|
</html>
|