Project

General

Profile

Download (4.47 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 2af86dda Phil Davis
if (!is_array($config['ppps']['ppp'])) {
69 c5ce8398 jim-p
	$config['ppps']['ppp'] = array();
70 2af86dda Phil Davis
}
71 c5ce8398 jim-p
$a_ppps = $config['ppps']['ppp'];
72
73 aa82505e Phil Davis
$pgtitle = array(gettext("Interfaces"), gettext("PPPs"));
74 b32dd0a6 jim-p
$shortcut_section = "interfaces";
75 589f92bb gnhb
include("head.inc");
76
77 68a7712c sbeaver
$tab_array = array();
78 26b4bef8 k-paulius
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
79 006d23d4 sbeaver
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
80
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
81
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
82
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
83
$tab_array[] = array(gettext("PPPs"), true, "interfaces_ppps.php");
84 26b4bef8 k-paulius
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
85
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
86 006d23d4 sbeaver
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
87 26b4bef8 k-paulius
$tab_array[] = array(gettext("LAGGs"), false, "interfaces_lagg.php");
88 68a7712c sbeaver
display_top_tabs($tab_array);
89 589f92bb gnhb
?>
90 060ed238 Stephen Beaver
<div class="panel panel-default">
91 70dc5cd6 Phil Davis
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('PPP Interfaces')?></h2></div>
92 060ed238 Stephen Beaver
	<div class="panel-body">
93
		<div class="table-responsive">
94 1c10ce97 PiBa-NL
			<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
95 060ed238 Stephen Beaver
				<thead>
96
					<tr>
97 70dc5cd6 Phil Davis
						<th><?=gettext("Interface"); ?></th>
98
						<th><?=gettext("Interface(s)/Port(s)"); ?></th>
99
						<th><?=gettext("Description"); ?></th>
100
						<th><?=gettext("Actions")?></th>
101 060ed238 Stephen Beaver
					</tr>
102
				</thead>
103
				<tbody>
104 68a7712c sbeaver
<?php
105
106
$i = 0;
107 589f92bb gnhb
108 68a7712c sbeaver
foreach ($a_ppps as $id => $ppp) {
109
?>
110 060ed238 Stephen Beaver
					<tr>
111
						<td>
112
							<?=htmlspecialchars($ppp['if'])?>
113
						</td>
114
						<td>
115 68a7712c sbeaver
<?php
116
	$portlist = explode(",", $ppp['ports']);
117
	foreach ($portlist as $portid => $port) {
118 aa82505e Phil Davis
		if ($port != get_real_interface($port) && $ppp['type'] != "ppp") {
119 68a7712c sbeaver
			$portlist[$portid] = convert_friendly_interface_to_friendly_descr($port);
120 aa82505e Phil Davis
		}
121 68a7712c sbeaver
	}
122 060ed238 Stephen Beaver
							echo htmlspecialchars(implode(",", $portlist));
123 68a7712c sbeaver
?>
124 060ed238 Stephen Beaver
						</td>
125
						<td>
126
							<?=htmlspecialchars($ppp['descr'])?>
127
						</td>
128
						<td>
129 4401107f Steve Beaver
							<a class="fa fa-pencil"	title="<?=gettext('Edit PPP interface')?>"	href="interfaces_ppps_edit.php?id=<?=$i?>"></a>
130 f34455d8 Steve Beaver
							<a class="fa fa-trash"	title="<?=gettext('Delete PPP interface')?>"	href="interfaces_ppps.php?act=del&amp;id=<?=$i?>" usepost></a>
131 060ed238 Stephen Beaver
						</td>
132
					</tr>
133 589f92bb gnhb
<?php
134 68a7712c sbeaver
	$i++;
135
}
136 589f92bb gnhb
?>
137 060ed238 Stephen Beaver
				</tbody>
138
			</table>
139
		</div>
140
	</div>
141 68a7712c sbeaver
</div>
142 060ed238 Stephen Beaver
143
<nav class="action-buttons">
144 4401107f Steve Beaver
	<a href="interfaces_ppps_edit.php" class="btn btn-success btn-sm">
145 060ed238 Stephen Beaver
		<i class="fa fa-plus icon-embed-btn"></i>
146
		<?=gettext("Add")?>
147
	</a>
148
</nav>
149
150 68a7712c sbeaver
<?php
151
include("foot.inc");