Project

General

Profile

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

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

    
70
require("guiconfig.inc");
71
require_once("functions.inc");
72

    
73
function ppp_inuse($num) {
74
	global $config, $g;
75

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

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

    
87
	return false;
88
}
89

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

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

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

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

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

    
140
$i = 0;
141

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

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

    
(94-94/234)