Project

General

Profile

Download (6.84 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	system_gateways.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-gateways
37
##|*NAME=System: Gateways page
38
##|*DESCR=Allow access to the 'System: Gateways' page.
39
##|*MATCH=system_gateways.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
$a_gateways = return_gateways_array();
48
$a_gateways_arr = array();
49
foreach($a_gateways as $gw) {
50
	$a_gateways_arr[] = $gw;
51
}
52
$a_gateways = $a_gateways_arr;
53
$changedesc = "Gateways: ";
54

    
55
if ($_POST) {
56

    
57
	$pconfig = $_POST;
58

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

    
61
		$retval = 0;
62

    
63
		$retval = system_routing_configure();
64
		$retval |= filter_configure();
65
		/* reconfigure our gateway monitor */
66
		setup_gateways_monitor();
67

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

    
74
if ($_GET['act'] == "del") {
75
	if ($a_gateways[$_GET['id']]) {
76
		/* remove the real entry */
77
		$realid = $a_gateways[$_GET['id']]['attribute'];
78
		$a_gateways = &$config['gateways']['gateway_item'];
79

    
80
		$changedesc .= "removed gateway {$realid}";
81
		unset($a_gateways[$realid]);
82
		write_config($changedesc);
83
		mark_subsystem_dirty('staticroutes');
84
		header("Location: system_gateways.php");
85
		exit;
86
	}
87
}
88

    
89

    
90
$pgtitle = array("System","Gateways");
91
include("head.inc");
92

    
93
?>
94

    
95
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
96
<?php include("fbegin.inc"); ?>
97
<form action="system_gateways.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("The gateway configuration has been changed.<br>You must apply the changes in order for them to take 
102
effect.");?><br>
103
<?php endif; ?>
104
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
105
		<tr>
106
		  <td>
107
<?php
108
			$tab_array = array();
109
			$tab_array[0] = array("Gateways", true, "system_gateways.php");
110
			$tab_array[1] = array("Routes", false, "system_routes.php");
111
			$tab_array[2] = array("Groups", false, "system_gateway_groups.php");
112
			$tab_array[3] = array("Settings", false, "system_gateways_settings.php");
113
			display_top_tabs($tab_array);
114
?>
115
</td></tr>
116
 <tr>
117
   <td>
118
	<div id="mainarea">
119
             <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
120
                <tr>
121
                  <td width="15%" class="listhdrr">Name</td>
122
                  <td width="15%" class="listhdrr">Interface</td>
123
                  <td width="20%" class="listhdrr">Gateway</td>
124
                  <td width="20%" class="listhdrr">Monitor IP</td>
125
                  <td width="30%" class="listhdr">Description</td>
126
                  <td width="10%" class="list">
127
			<table border="0" cellspacing="0" cellpadding="1">
128
			   <tr>
129
				<td width="17"></td>
130
				<td><a href="system_gateways_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
131
			   </tr>
132
			</table>
133
		  </td>
134
		</tr>
135
			  <?php $i = 0; foreach ($a_gateways as $gateway): ?>
136
                <tr>
137
                  <td class="listlr" ondblclick="document.location='system_gateways_edit.php?id=<?=$i;?>';">
138
                    <?php
139
			echo $gateway['name'];
140
			if(isset($gateway['defaultgw'])) {
141
				echo " <strong>(default)<strong>";
142
			}
143
			?>
144
			
145
                  </td>
146
                  <td class="listr" ondblclick="document.location='system_gateways_edit.php?id=<?=$i;?>';">
147
                    <?php
148
				echo htmlspecialchars(convert_real_interface_to_friendly_descr($gateway['interface']));
149
			?>
150
                  </td>
151
                  <td class="listr" ondblclick="document.location='system_gateways_edit.php?id=<?=$i;?>';">
152
				  <?php
153
					if(isset($gateway['interfacegateway'])) {
154
						echo strtoupper($gateway['interface']) . " ";
155
					} else {
156
						echo $gateway['gateway'] . " ";
157
					}
158
				  ?>
159
                  </td>
160
                  <td class="listr" ondblclick="document.location='system_gateways_edit.php?id=<?=$i;?>';">
161
                    <?=htmlspecialchars($gateway['monitor']);?>&nbsp;
162
                  </td>
163
                  <td class="listbg" ondblclick="document.location='system_gateways_edit.php?id=<?=$i;?>';">
164
                    <?=htmlspecialchars($gateway['descr']);?>&nbsp;
165
                  </td>
166
                  <td valign="middle" nowrap class="list">
167
			<table border="0" cellspacing="0" cellpadding="1">
168
			   <tr>
169
				<td><a href="system_gateways_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a>
170
				<td><a href="system_gateways.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this gateway?')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
171
			   </tr>
172
			   <tr>
173
				<td width="17"></td>
174
				<td><a href="system_gateways_edit.php?dup=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
175
			   </tr>
176
			</table>
177

    
178
		</tr>
179
			  <?php $i++; endforeach; ?>
180
                <tr>
181
                  <td class="list" colspan="5"></td>
182
                  <td class="list">
183
			<table border="0" cellspacing="0" cellpadding="1">
184
			   <tr>
185
				<td width="17"></td>
186
				<td><a href="system_gateways_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
187
			   </tr>
188
		                    </table>
189
				  </td>
190
		                </tr>
191
			</table>
192
			</div>
193
			</td>
194
		  </tr>
195
		</table>
196
            </form>
197
<?php include("fend.inc"); ?>
198
</body>
199
</html>
(181-181/214)