Project

General

Profile

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