Project

General

Profile

Download (6.67 KB) Statistics
| Branch: | Tag: | Revision:
1 d173230c Seth Mos
<?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 6b07c15a Matthew Grooms
##|+PRIV
33
##|*IDENT=page-system-gateways
34
##|*NAME=System: Gateways page
35
##|*DESCR=Allow access to the 'System: Gateways' page.
36
##|*MATCH=system_gateways.php*
37
##|-PRIV
38
39
40 d173230c Seth Mos
require("guiconfig.inc");
41
42
if (!is_array($config['gateways']['gateway_item']))
43
	$config['gateways']['gateway_item'] = array();
44
45
$a_gateways = &$config['gateways']['gateway_item'];
46
$changedesc = "Gateways: ";
47
48
if ($_POST) {
49
50
	$pconfig = $_POST;
51
52
	if ($_POST['apply']) {
53
54
		$retval = 0;
55
56
		$retval = system_routing_configure();
57
		$retval |= filter_configure();
58 13bbe450 Seth Mos
		/* reconfigure our gateway monitor */
59
		setup_gateways_monitor();
60 d173230c Seth Mos
61
		$savemsg = get_std_save_message($retval);
62
		if ($retval == 0) {
63
			if (file_exists($d_staticroutesdirty_path)) {
64
				config_lock();
65
				unlink($d_staticroutesdirty_path);
66
				config_unlock();
67
			}
68
		}
69
	}
70
}
71
72
if ($_GET['act'] == "del") {
73
	if ($a_gateways[$_GET['id']]) {
74
		$changedesc .= "removed gateway {$_GET['id']}";
75
		unset($a_gateways[$_GET['id']]);
76
		write_config($changedesc);
77
		touch($d_staticroutesdirty_path);
78
		header("Location: system_gateways.php");
79
		exit;
80
	}
81
}
82
83 d88c6a9f Scott Ullrich
$pgtitle = array("System","Gateways");
84 d173230c Seth Mos
include("head.inc");
85
86
?>
87
88
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
89
<?php include("fbegin.inc"); ?>
90
<form action="system_gateways.php" method="post">
91
<input type="hidden" name="y1" value="1">
92
<?php if ($savemsg) print_info_box($savemsg); ?>
93
<?php if (file_exists($d_staticroutesdirty_path)): ?><p>
94
<?php print_info_box_np("The gateway configuration has been changed.<br>You must apply the changes in order for them to take 
95
effect.");?><br>
96
<?php endif; ?>
97
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
98
		<tr>
99
		  <td>
100
<?php
101
			$tab_array = array();
102
			$tab_array[0] = array("Gateways", true, "system_gateways.php");
103
			$tab_array[1] = array("Routes", false, "system_routes.php");
104 c67a0d18 Seth Mos
			$tab_array[2] = array("Groups", false, "system_gateway_groups.php");
105 d173230c Seth Mos
			display_top_tabs($tab_array);
106
?>
107 40e59dbf Scott Ullrich
</td></tr>
108
 <tr>
109
   <td>
110
	<div id="mainarea">
111
             <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
112 d173230c Seth Mos
                <tr>
113
                  <td width="15%" class="listhdrr">Name</td>
114
                  <td width="15%" class="listhdrr">Interface</td>
115
                  <td width="20%" class="listhdrr">Gateway</td>
116
                  <td width="20%" class="listhdrr">Monitor IP</td>
117
                  <td width="30%" class="listhdr">Description</td>
118
                  <td width="10%" class="list">
119
			<table border="0" cellspacing="0" cellpadding="1">
120
			   <tr>
121
				<td width="17"></td>
122
				<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>
123
			   </tr>
124
			</table>
125
		  </td>
126
		</tr>
127
			  <?php $i = 0; foreach ($a_gateways as $gateway): ?>
128
                <tr>
129
                  <td class="listlr" ondblclick="document.location='system_gateways_edit.php?id=<?=$i;?>';">
130
                    <?php
131
			echo $gateway['name'];
132
			if(isset($gateway['defaultgw'])) {
133
				echo " <strong>(default)<strong>";
134
			}
135
			?>
136
			
137
                  </td>
138
                  <td class="listr" ondblclick="document.location='system_gateways_edit.php?id=<?=$i;?>';">
139
                    <?php
140 1c8e901d Ermal Luçi
				$iflabels = get_configured_interface_with_descr(false, true);
141 d173230c Seth Mos
				echo htmlspecialchars($iflabels[$gateway['interface']]); ?>
142
                  </td>
143
                  <td class="listr" ondblclick="document.location='system_gateways_edit.php?id=<?=$i;?>';">
144
				  <?php
145
					if(isset($gateway['interfacegateway'])) {
146
						echo strtoupper($gateway['interface']) . " ";
147
					} else {
148
						echo $gateway['gateway'] . " ";
149
					}
150
				  ?>
151
                  </td>
152
                  <td class="listr" ondblclick="document.location='system_gateways_edit.php?id=<?=$i;?>';">
153
                    <?=htmlspecialchars($gateway['monitor']);?>&nbsp;
154
                  </td>
155
                  <td class="listbg" ondblclick="document.location='system_gateways_edit.php?id=<?=$i;?>';">
156
                    <font color="#FFFFFF"><?=htmlspecialchars($gateway['descr']);?>&nbsp;
157
                  </td>
158
                  <td valign="middle" nowrap class="list">
159
			<table border="0" cellspacing="0" cellpadding="1">
160
			   <tr>
161
				<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>
162
				<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>
163
			   </tr>
164
			   <tr>
165
				<td width="17"></td>
166
				<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>
167
			   </tr>
168
			</table>
169
170
		</tr>
171
			  <?php $i++; endforeach; ?>
172
                <tr>
173
                  <td class="list" colspan="5"></td>
174
                  <td class="list">
175
			<table border="0" cellspacing="0" cellpadding="1">
176
			   <tr>
177
				<td width="17"></td>
178
				<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>
179
			   </tr>
180 40e59dbf Scott Ullrich
		                    </table>
181
				  </td>
182
		                </tr>
183 d173230c Seth Mos
			</table>
184 40e59dbf Scott Ullrich
			</div>
185
			</td>
186
		  </tr>
187
		</table>
188 d173230c Seth Mos
            </form>
189
<?php include("fend.inc"); ?>
190
</body>
191
</html>