Project

General

Profile

Download (4.75 KB) Statistics
| Branch: | Tag: | Revision:
1 589f92bb gnhb
<?php
2 919d91f9 Phil Davis
/*
3 c5d81585 Renato Botelho
 * interfaces_ppps.php
4 191cb31d Stephen Beaver
 *
5 c5d81585 Renato Botelho
 * part of pfSense (https://www.pfsense.org)
6 38809d47 Renato Botelho do Couto
 * Copyright (c) 2004-2013 BSD Perimeter
7
 * Copyright (c) 2013-2016 Electric Sheep Fencing
8 0284d79e jim-p
 * Copyright (c) 2014-2020 Rubicon Communications, LLC (Netgate)
9 c5d81585 Renato Botelho
 * All rights reserved.
10 b9043cdc Stephen Beaver
 *
11 c5d81585 Renato Botelho
 * originally based on m0n0wall (http://m0n0.ch/wall)
12
 * Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
13
 * All rights reserved.
14 b9043cdc Stephen Beaver
 *
15 b12ea3fb Renato Botelho
 * Licensed under the Apache License, Version 2.0 (the "License");
16
 * you may not use this file except in compliance with the License.
17
 * You may obtain a copy of the License at
18 b9043cdc Stephen Beaver
 *
19 b12ea3fb Renato Botelho
 * http://www.apache.org/licenses/LICENSE-2.0
20 b9043cdc Stephen Beaver
 *
21 b12ea3fb Renato Botelho
 * Unless required by applicable law or agreed to in writing, software
22
 * distributed under the License is distributed on an "AS IS" BASIS,
23
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
 * See the License for the specific language governing permissions and
25
 * limitations under the License.
26 b9043cdc Stephen Beaver
 */
27 589f92bb gnhb
28
##|+PRIV
29 42809b4a gnhb
##|*IDENT=page-interfaces-ppps
30 9599211d jim-p
##|*NAME=Interfaces: PPPs
31
##|*DESCR=Allow access to the 'Interfaces: PPPs' page.
32 42809b4a gnhb
##|*MATCH=interfaces_ppps.php*
33 589f92bb gnhb
##|-PRIV
34
35 c81ef6e2 Phil Davis
require_once("guiconfig.inc");
36 cfb9eb9f Carlos Eduardo Ramos
require_once("functions.inc");
37 589f92bb gnhb
38 e51cea69 gnhb
function ppp_inuse($num) {
39 c5ce8398 jim-p
	global $config, $g;
40 006d23d4 sbeaver
41 80fe8369 Phil Davis
	$iflist = get_configured_interface_list(true);
42 2af86dda Phil Davis
	if (!is_array($config['ppps']['ppp'])) {
43 c5ce8398 jim-p
		return false;
44 2af86dda Phil Davis
	}
45 c5ce8398 jim-p
46 42809b4a gnhb
	foreach ($iflist as $if) {
47 2af86dda Phil Davis
		if ($config['interfaces'][$if]['if'] == $config['ppps']['ppp'][$num]['if']) {
48 42809b4a gnhb
			return true;
49 2af86dda Phil Davis
		}
50 42809b4a gnhb
	}
51 006d23d4 sbeaver
52 42809b4a gnhb
	return false;
53 589f92bb gnhb
}
54
55 f34455d8 Steve Beaver
if ($_POST['act'] == "del") {
56 589f92bb gnhb
	/* check if still in use */
57 f34455d8 Steve Beaver
	if (ppp_inuse($_POST['id'])) {
58 f2047bd0 Rafael Lucas
		$input_errors[] = gettext("This point-to-point link cannot be deleted because it is still being used as an interface.");
59 f34455d8 Steve Beaver
	} elseif (is_array($config['ppps']['ppp']) && is_array($config['ppps']['ppp'][$_POST['id']])) {
60 c5ce8398 jim-p
61 f34455d8 Steve Beaver
		unset($config['ppps']['ppp'][$_POST['id']]['pppoe-reset-type']);
62
		handle_pppoe_reset($config['ppps']['ppp'][$_POST['id']]);
63
		unset($config['ppps']['ppp'][$_POST['id']]);
64 e85ae672 Renato Botelho do Couto
		write_config("PPP interface deleted");
65 42809b4a gnhb
		header("Location: interfaces_ppps.php");
66 589f92bb gnhb
		exit;
67
	}
68
}
69
70 1a5e85f6 Steve Beaver
if (!is_array($config['ppps'])) {
71
	$config['ppps'] = array();
72
}
73
74 2af86dda Phil Davis
if (!is_array($config['ppps']['ppp'])) {
75 c5ce8398 jim-p
	$config['ppps']['ppp'] = array();
76 2af86dda Phil Davis
}
77 1a5e85f6 Steve Beaver
78 c5ce8398 jim-p
$a_ppps = $config['ppps']['ppp'];
79
80 aa82505e Phil Davis
$pgtitle = array(gettext("Interfaces"), gettext("PPPs"));
81 b32dd0a6 jim-p
$shortcut_section = "interfaces";
82 589f92bb gnhb
include("head.inc");
83
84 68a7712c sbeaver
$tab_array = array();
85 26b4bef8 k-paulius
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
86 006d23d4 sbeaver
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
87
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
88
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
89
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
90
$tab_array[] = array(gettext("PPPs"), true, "interfaces_ppps.php");
91 26b4bef8 k-paulius
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
92
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
93 b6ea9c61 Viktor G
$tab_array[] = array(gettext("VXLANs"), false, "interfaces_vxlan.php");
94 006d23d4 sbeaver
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
95 26b4bef8 k-paulius
$tab_array[] = array(gettext("LAGGs"), false, "interfaces_lagg.php");
96 68a7712c sbeaver
display_top_tabs($tab_array);
97 589f92bb gnhb
?>
98 060ed238 Stephen Beaver
<div class="panel panel-default">
99 70dc5cd6 Phil Davis
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('PPP Interfaces')?></h2></div>
100 060ed238 Stephen Beaver
	<div class="panel-body">
101
		<div class="table-responsive">
102 1c10ce97 PiBa-NL
			<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
103 060ed238 Stephen Beaver
				<thead>
104
					<tr>
105 70dc5cd6 Phil Davis
						<th><?=gettext("Interface"); ?></th>
106
						<th><?=gettext("Interface(s)/Port(s)"); ?></th>
107
						<th><?=gettext("Description"); ?></th>
108
						<th><?=gettext("Actions")?></th>
109 060ed238 Stephen Beaver
					</tr>
110
				</thead>
111
				<tbody>
112 68a7712c sbeaver
<?php
113
114
$i = 0;
115 589f92bb gnhb
116 82db8285 Steve Beaver
117
if (is_array($a_ppps)) {
118
	foreach ($a_ppps as $id => $ppp) {
119 68a7712c sbeaver
?>
120 060ed238 Stephen Beaver
					<tr>
121
						<td>
122
							<?=htmlspecialchars($ppp['if'])?>
123
						</td>
124
						<td>
125 68a7712c sbeaver
<?php
126
	$portlist = explode(",", $ppp['ports']);
127
	foreach ($portlist as $portid => $port) {
128 aa82505e Phil Davis
		if ($port != get_real_interface($port) && $ppp['type'] != "ppp") {
129 68a7712c sbeaver
			$portlist[$portid] = convert_friendly_interface_to_friendly_descr($port);
130 aa82505e Phil Davis
		}
131 68a7712c sbeaver
	}
132 060ed238 Stephen Beaver
							echo htmlspecialchars(implode(",", $portlist));
133 68a7712c sbeaver
?>
134 060ed238 Stephen Beaver
						</td>
135
						<td>
136
							<?=htmlspecialchars($ppp['descr'])?>
137
						</td>
138
						<td>
139 4401107f Steve Beaver
							<a class="fa fa-pencil"	title="<?=gettext('Edit PPP interface')?>"	href="interfaces_ppps_edit.php?id=<?=$i?>"></a>
140 f34455d8 Steve Beaver
							<a class="fa fa-trash"	title="<?=gettext('Delete PPP interface')?>"	href="interfaces_ppps.php?act=del&amp;id=<?=$i?>" usepost></a>
141 060ed238 Stephen Beaver
						</td>
142
					</tr>
143 589f92bb gnhb
<?php
144 68a7712c sbeaver
	$i++;
145 82db8285 Steve Beaver
	}
146 68a7712c sbeaver
}
147 589f92bb gnhb
?>
148 060ed238 Stephen Beaver
				</tbody>
149
			</table>
150
		</div>
151
	</div>
152 68a7712c sbeaver
</div>
153 060ed238 Stephen Beaver
154
<nav class="action-buttons">
155 4401107f Steve Beaver
	<a href="interfaces_ppps_edit.php" class="btn btn-success btn-sm">
156 060ed238 Stephen Beaver
		<i class="fa fa-plus icon-embed-btn"></i>
157
		<?=gettext("Add")?>
158
	</a>
159
</nav>
160
161 68a7712c sbeaver
<?php
162
include("foot.inc");