Project

General

Profile

Download (5.99 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/* ====================================================================
4
 *	Copyright (c)  2004-2015  Electric Sheep Fencing, LLC. All rights reserved.
5
 *
6
 *  Some or all of this file is based on the m0n0wall project which is
7
 *  Copyright (c)  2004 Manuel Kasper (BSD 2 clause)
8
 *
9
 *	Redistribution and use in source and binary forms, with or without modification,
10
 *	are permitted provided that the following conditions are met:
11
 *
12
 *	1. Redistributions of source code must retain the above copyright notice,
13
 *		this list of conditions and the following disclaimer.
14
 *
15
 *	2. Redistributions in binary form must reproduce the above copyright
16
 *		notice, this list of conditions and the following disclaimer in
17
 *		the documentation and/or other materials provided with the
18
 *		distribution.
19
 *
20
 *	3. All advertising materials mentioning features or use of this software
21
 *		must display the following acknowledgment:
22
 *		"This product includes software developed by the pfSense Project
23
 *		 for use in the pfSense software distribution. (http://www.pfsense.org/).
24
 *
25
 *	4. The names "pfSense" and "pfSense Project" must not be used to
26
 *		 endorse or promote products derived from this software without
27
 *		 prior written permission. For written permission, please contact
28
 *		 coreteam@pfsense.org.
29
 *
30
 *	5. Products derived from this software may not be called "pfSense"
31
 *		nor may "pfSense" appear in their names without prior written
32
 *		permission of the Electric Sheep Fencing, LLC.
33
 *
34
 *	6. Redistributions of any form whatsoever must retain the following
35
 *		acknowledgment:
36
 *
37
 *	"This product includes software developed by the pfSense Project
38
 *	for use in the pfSense software distribution (http://www.pfsense.org/).
39
 *
40
 *	THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
41
 *	EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42
 *	IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43
 *	PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
44
 *	ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45
 *	SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46
 *	NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47
 *	LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48
 *	HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49
 *	STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50
 *	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51
 *	OF THE POSSIBILITY OF SUCH DAMAGE.
52
 *
53
 *	====================================================================
54
 *
55
 */
56
/*
57
	pfSense_BUILDER_BINARIES:	/sbin/ifconfig
58
	pfSense_MODULE: interfaces
59
*/
60

    
61
##|+PRIV
62
##|*IDENT=page-interfaces-ppps
63
##|*NAME=Interfaces: ppps page
64
##|*DESCR=Allow access to the 'Interfaces: ppps' page.
65
##|*MATCH=interfaces_ppps.php*
66
##|-PRIV
67

    
68
require("guiconfig.inc");
69
require_once("functions.inc");
70

    
71
function ppp_inuse($num) {
72
	global $config, $g;
73

    
74
	$iflist = get_configured_interface_list(false, true);
75
	if (!is_array($config['ppps']['ppp'])) {
76
		return false;
77
	}
78

    
79
	foreach ($iflist as $if) {
80
		if ($config['interfaces'][$if]['if'] == $config['ppps']['ppp'][$num]['if']) {
81
			return true;
82
		}
83
	}
84

    
85
	return false;
86
}
87

    
88
if ($_GET['act'] == "del") {
89
	/* check if still in use */
90
	if (ppp_inuse($_GET['id'])) {
91
		$input_errors[] = gettext("This point-to-point link cannot be deleted because it is still being used as an interface.");
92
	} elseif (is_array($config['ppps']['ppp']) && is_array($config['ppps']['ppp'][$_GET['id']])) {
93

    
94
		unset($config['ppps']['ppp'][$_GET['id']]['pppoe-reset-type']);
95
		handle_pppoe_reset($config['ppps']['ppp'][$_GET['id']]);
96
		unset($config['ppps']['ppp'][$_GET['id']]);
97
		write_config();
98
		header("Location: interfaces_ppps.php");
99
		exit;
100
	}
101
}
102

    
103
if (!is_array($config['ppps']['ppp'])) {
104
	$config['ppps']['ppp'] = array();
105
}
106
$a_ppps = $config['ppps']['ppp'];
107

    
108
$pgtitle = array(gettext("Interfaces"),gettext("PPPs"));
109
$shortcut_section = "interfaces";
110
include("head.inc");
111

    
112
$tab_array = array();
113
$tab_array[] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
114
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
115
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
116
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
117
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
118
$tab_array[] = array(gettext("PPPs"), true, "interfaces_ppps.php");
119
$tab_array[] = array(gettext("GRE"), false, "interfaces_gre.php");
120
$tab_array[] = array(gettext("GIF"), false, "interfaces_gif.php");
121
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
122
$tab_array[] = array(gettext("LAGG"), false, "interfaces_lagg.php");
123
display_top_tabs($tab_array);
124
?>
125
<div class="table-responsive">
126
	<table class="table table-striped table-hover table-condensed">
127
		<thead>
128
			<tr>
129
			  <th><?=gettext("Interface"); ?></th>
130
			  <th><?=gettext("Interface(s)/Port(s)"); ?></th>
131
			  <th><?=gettext("Description"); ?></th>
132
			  <th></th>
133
			</tr>
134
		</thead>
135
		<tbody>
136
<?php
137

    
138
$i = 0;
139

    
140
foreach ($a_ppps as $id => $ppp) {
141
?>
142
			<tr>
143
				<td>
144
					<?=htmlspecialchars($ppp['if'])?>
145
				</td>
146
				<td>
147
<?php
148
	$portlist = explode(",", $ppp['ports']);
149
	foreach ($portlist as $portid => $port) {
150
		if ($port != get_real_interface($port) && $ppp['type'] != "ppp")
151
			$portlist[$portid] = convert_friendly_interface_to_friendly_descr($port);
152
	}
153
					echo htmlspecialchars(implode(",", $portlist));
154
?>
155
				</td>
156
				<td>
157
					<?=htmlspecialchars($ppp['descr'])?>
158
				</td>
159
				<td>
160
					<a class="fa fa-pencil"	title="<?=gettext('Edit PPP interface')?>"	href="interfaces_ppps_edit.php?id=<?=$i?>"></a>
161
					<a class="fa fa-trash"	title="<?=gettext('Delete PPP interface')?>"	href="interfaces_ppps.php?act=del&amp;id=<?=$i?>"></a>
162
				</td>
163
			</tr>
164
<?php
165
	$i++;
166
}
167
?>
168
		</tbody>
169
	</table>
170

    
171
	<nav class="action-buttons">
172
		<a href="interfaces_ppps_edit.php" class="btn btn-success btn-sm">
173
	   		<i class="fa fa-plus icon-embed-btn"></i>
174
	   		<?=gettext("Add")?>
175
	   	</a>
176
	</nav>
177
</div>
178
<?php
179
include("foot.inc");
180

    
(94-94/234)