Project

General

Profile

Download (6.96 KB) Statistics
| Branch: | Tag: | Revision:
1 2f35382a Seth Mos
<?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 1d333258 Scott Ullrich
/*
32
	pfSense_MODULE:	routing
33
*/
34 2f35382a Seth Mos
35 6b07c15a Matthew Grooms
##|+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 2f35382a Seth Mos
require("guiconfig.inc");
43 7a927e67 Scott Ullrich
require_once("functions.inc");
44
require_once("filter.inc");
45
require_once("shaper.inc");
46 2f35382a Seth Mos
47
if (!is_array($config['gateways']['gateway_group']))
48
	$config['gateways']['gateway_group'] = array();
49
50
$a_gateway_groups = &$config['gateways']['gateway_group'];
51 5ccd9857 Seth Mos
$a_gateways = &$config['gateways']['gateway_item'];
52 198afa09 Vinicius Coque
$changedesc = gettext("Gateway Groups") . ": ";
53 2f35382a Seth Mos
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 33d72c67 Ermal
		/* reconfigure our gateway monitor */
65
		setup_gateways_monitor();
66 2f35382a Seth Mos
67
		$savemsg = get_std_save_message($retval);
68 a368a026 Ermal Lu?i
		if ($retval == 0)
69
			clear_subsystem_dirty('staticroutes');
70 2f35382a Seth Mos
	}
71
}
72
73
if ($_GET['act'] == "del") {
74
	if ($a_gateway_groups[$_GET['id']]) {
75 198afa09 Vinicius Coque
		$changedesc .= gettext("removed gateway group") . " {$_GET['id']}";
76 f78302e8 Ermal
		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 2f35382a Seth Mos
		unset($a_gateway_groups[$_GET['id']]);
81
		write_config($changedesc);
82 a368a026 Ermal Lu?i
		mark_subsystem_dirty('staticroutes');
83 2f35382a Seth Mos
		header("Location: system_gateway_groups.php");
84
		exit;
85
	}
86
}
87
88 198afa09 Vinicius Coque
$pgtitle = array(gettext("System"),gettext("Gateway Groups"));
89 02ca24c9 jim-p
$statusurl = "status_gateway_groups.php";
90
91 2f35382a Seth Mos
include("head.inc");
92
93
?>
94
95
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
96
<?php include("fbegin.inc"); ?>
97 5ccd9857 Seth Mos
<form action="system_gateway_groups.php" method="post">
98 2f35382a Seth Mos
<input type="hidden" name="y1" value="1">
99
<?php if ($savemsg) print_info_box($savemsg); ?>
100 a368a026 Ermal Lu?i
<?php if (is_subsystem_dirty('staticroutes')): ?><p>
101 0e94685b Renato Botelho
<?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 2f35382a Seth Mos
<?php endif; ?>
103
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
104
		<tr>
105
		  <td>
106
<?php
107
			$tab_array = array();
108 198afa09 Vinicius Coque
			$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 2f35382a Seth Mos
			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 198afa09 Vinicius Coque
                  <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 2f35382a Seth Mos
                  <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 5ccd9857 Seth Mos
			foreach($gateway_group['item'] as $item) {
143
				$itemsplit = explode("|", $item);
144 adc79e41 Scott Ullrich
				echo htmlspecialchars(strtoupper($itemsplit[0])) . "<br/>\n";
145 5ccd9857 Seth Mos
			}
146
		    ?>
147 2f35382a Seth Mos
                  </td>
148
                  <td class="listr" ondblclick="document.location='system_gateway_groups_edit.php?id=<?=$i;?>';">
149
		    <?php
150 5ccd9857 Seth Mos
			foreach($gateway_group['item'] as $item) {
151
				$itemsplit = explode("|", $item);
152
				echo "Tier ". htmlspecialchars($itemsplit[1]) . "<br/>\n";
153
			}
154
		    ?>
155 2f35382a Seth Mos
                  </td>
156
                  <td class="listbg" ondblclick="document.location='system_gateway_groups_edit.php?id=<?=$i;?>';">
157 33300c73 Scott Ullrich
						<?=htmlspecialchars($gateway_group['descr']);?>&nbsp;
158 2f35382a Seth Mos
                  </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 198afa09 Vinicius Coque
				<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 2f35382a Seth Mos
			   </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>