Project

General

Profile

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

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

    
65
require_once("guiconfig.inc");
66
require_once("functions.inc");
67

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

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

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

    
82
	return false;
83
}
84

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

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

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

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

    
109
$tab_array = array();
110
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
111
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
112
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
113
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
114
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
115
$tab_array[] = array(gettext("PPPs"), true, "interfaces_ppps.php");
116
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
117
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
118
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
119
$tab_array[] = array(gettext("LAGGs"), false, "interfaces_lagg.php");
120
display_top_tabs($tab_array);
121
?>
122
<div class="panel panel-default">
123
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('PPP Interfaces')?></h2></div>
124
	<div class="panel-body">
125
		<div class="table-responsive">
126
			<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
127
				<thead>
128
					<tr>
129
						<th><?=gettext("Interface"); ?></th>
130
						<th><?=gettext("Interface(s)/Port(s)"); ?></th>
131
						<th><?=gettext("Description"); ?></th>
132
						<th><?=gettext("Actions")?></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
	}
154
							echo htmlspecialchars(implode(",", $portlist));
155
?>
156
						</td>
157
						<td>
158
							<?=htmlspecialchars($ppp['descr'])?>
159
						</td>
160
						<td>
161
							<a class="fa fa-pencil"	title="<?=gettext('Edit PPP interface')?>"	href="interfaces_ppps_edit.php?id=<?=$i?>"></a>
162
							<a class="fa fa-trash"	title="<?=gettext('Delete PPP interface')?>"	href="interfaces_ppps.php?act=del&amp;id=<?=$i?>"></a>
163
						</td>
164
					</tr>
165
<?php
166
	$i++;
167
}
168
?>
169
				</tbody>
170
			</table>
171
		</div>
172
	</div>
173
</div>
174

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

    
182
<?php
183
include("foot.inc");
184

    
(80-80/227)