Project

General

Profile

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

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

    
66
require("guiconfig.inc");
67
require_once("functions.inc");
68

    
69
function ppp_inuse($num) {
70
	global $config, $g;
71

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

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

    
83
	return false;
84
}
85

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

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

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

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

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

    
136
$i = 0;
137

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

    
169
	<nav class="action-buttons">
170
	   <a href="interfaces_ppps_edit.php" class="btn btn-success"><?=gettext("Add")?></a>
171
	</nav>
172
</div>
173
<?php
174
include("foot.inc");
175

    
(94-94/233)