Project

General

Profile

Download (6.5 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
require("guiconfig.inc");
33

    
34
if (!is_array($config['gateways']['gateway_item']))
35
	$config['gateways']['gateway_item'] = array();
36

    
37
$a_gateways = &$config['gateways']['gateway_item'];
38
$changedesc = "Gateways: ";
39

    
40
if ($_POST) {
41

    
42
	$pconfig = $_POST;
43

    
44
	if ($_POST['apply']) {
45

    
46
		$retval = 0;
47

    
48
		$retval = system_routing_configure();
49
		$retval |= filter_configure();
50
		/* reconfigure our gateway monitor */
51
		setup_gateways_monitor();
52

    
53
		$savemsg = get_std_save_message($retval);
54
		if ($retval == 0) {
55
			if (file_exists($d_staticroutesdirty_path)) {
56
				config_lock();
57
				unlink($d_staticroutesdirty_path);
58
				config_unlock();
59
			}
60
		}
61
	}
62
}
63

    
64
if ($_GET['act'] == "del") {
65
	if ($a_gateways[$_GET['id']]) {
66
		$changedesc .= "removed gateway {$_GET['id']}";
67
		unset($a_gateways[$_GET['id']]);
68
		write_config($changedesc);
69
		touch($d_staticroutesdirty_path);
70
		header("Location: system_gateways.php");
71
		exit;
72
	}
73
}
74

    
75
$pgtitle = array("System","Gateways");
76
include("head.inc");
77

    
78
?>
79

    
80
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
81
<?php include("fbegin.inc"); ?>
82
<form action="system_gateways.php" method="post">
83
<input type="hidden" name="y1" value="1">
84
<?php if ($savemsg) print_info_box($savemsg); ?>
85
<?php if (file_exists($d_staticroutesdirty_path)): ?><p>
86
<?php print_info_box_np("The gateway configuration has been changed.<br>You must apply the changes in order for them to take 
87
effect.");?><br>
88
<?php endif; ?>
89
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
90
		<tr>
91
		  <td>
92
<?php
93
			$tab_array = array();
94
			$tab_array[0] = array("Gateways", true, "system_gateways.php");
95
			$tab_array[1] = array("Routes", false, "system_routes.php");
96
			$tab_array[2] = array("Groups", false, "system_gateway_groups.php");
97
			display_top_tabs($tab_array);
98
?>
99
</td></tr>
100
 <tr>
101
   <td>
102
	<div id="mainarea">
103
             <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
104
                <tr>
105
                  <td width="15%" class="listhdrr">Name</td>
106
                  <td width="15%" class="listhdrr">Interface</td>
107
                  <td width="20%" class="listhdrr">Gateway</td>
108
                  <td width="20%" class="listhdrr">Monitor IP</td>
109
                  <td width="30%" class="listhdr">Description</td>
110
                  <td width="10%" class="list">
111
			<table border="0" cellspacing="0" cellpadding="1">
112
			   <tr>
113
				<td width="17"></td>
114
				<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>
115
			   </tr>
116
			</table>
117
		  </td>
118
		</tr>
119
			  <?php $i = 0; foreach ($a_gateways as $gateway): ?>
120
                <tr>
121
                  <td class="listlr" ondblclick="document.location='system_gateways_edit.php?id=<?=$i;?>';">
122
                    <?php
123
			echo $gateway['name'];
124
			if(isset($gateway['defaultgw'])) {
125
				echo " <strong>(default)<strong>";
126
			}
127
			?>
128
			
129
                  </td>
130
                  <td class="listr" ondblclick="document.location='system_gateways_edit.php?id=<?=$i;?>';">
131
                    <?php
132
				$iflabels = get_configured_interface_with_descr();
133
				echo htmlspecialchars($iflabels[$gateway['interface']]); ?>
134
                  </td>
135
                  <td class="listr" ondblclick="document.location='system_gateways_edit.php?id=<?=$i;?>';">
136
				  <?php
137
					if(isset($gateway['interfacegateway'])) {
138
						echo strtoupper($gateway['interface']) . " ";
139
					} else {
140
						echo $gateway['gateway'] . " ";
141
					}
142
				  ?>
143
                  </td>
144
                  <td class="listr" ondblclick="document.location='system_gateways_edit.php?id=<?=$i;?>';">
145
                    <?=htmlspecialchars($gateway['monitor']);?>&nbsp;
146
                  </td>
147
                  <td class="listbg" ondblclick="document.location='system_gateways_edit.php?id=<?=$i;?>';">
148
                    <font color="#FFFFFF"><?=htmlspecialchars($gateway['descr']);?>&nbsp;
149
                  </td>
150
                  <td valign="middle" nowrap class="list">
151
			<table border="0" cellspacing="0" cellpadding="1">
152
			   <tr>
153
				<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>
154
				<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>
155
			   </tr>
156
			   <tr>
157
				<td width="17"></td>
158
				<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>
159
			   </tr>
160
			</table>
161

    
162
		</tr>
163
			  <?php $i++; endforeach; ?>
164
                <tr>
165
                  <td class="list" colspan="5"></td>
166
                  <td class="list">
167
			<table border="0" cellspacing="0" cellpadding="1">
168
			   <tr>
169
				<td width="17"></td>
170
				<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>
171
			   </tr>
172
		                    </table>
173
				  </td>
174
		                </tr>
175
			</table>
176
			</div>
177
			</td>
178
		  </tr>
179
		</table>
180
            </form>
181
<?php include("fend.inc"); ?>
182
</body>
183
</html>
(156-156/197)