Project

General

Profile

Download (4.57 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-2018 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
 * 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
 *
17
 * http://www.apache.org/licenses/LICENSE-2.0
18
 *
19
 * 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
 */
25

    
26
##|+PRIV
27
##|*IDENT=page-interfaces-ppps
28
##|*NAME=Interfaces: PPPs
29
##|*DESCR=Allow access to the 'Interfaces: PPPs' page.
30
##|*MATCH=interfaces_ppps.php*
31
##|-PRIV
32

    
33
require_once("guiconfig.inc");
34
require_once("functions.inc");
35

    
36
function ppp_inuse($num) {
37
	global $config, $g;
38

    
39
	$iflist = get_configured_interface_list(true);
40
	if (!is_array($config['ppps']['ppp'])) {
41
		return false;
42
	}
43

    
44
	foreach ($iflist as $if) {
45
		if ($config['interfaces'][$if]['if'] == $config['ppps']['ppp'][$num]['if']) {
46
			return true;
47
		}
48
	}
49

    
50
	return false;
51
}
52

    
53
if ($_POST['act'] == "del") {
54
	/* check if still in use */
55
	if (ppp_inuse($_POST['id'])) {
56
		$input_errors[] = gettext("This point-to-point link cannot be deleted because it is still being used as an interface.");
57
	} elseif (is_array($config['ppps']['ppp']) && is_array($config['ppps']['ppp'][$_POST['id']])) {
58

    
59
		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
		write_config();
63
		header("Location: interfaces_ppps.php");
64
		exit;
65
	}
66
}
67

    
68
if (!is_array($config['ppps'])) {
69
	$config['ppps'] = array();
70
}
71

    
72
if (!is_array($config['ppps']['ppp'])) {
73
	$config['ppps']['ppp'] = array();
74
}
75

    
76
$a_ppps = $config['ppps']['ppp'];
77

    
78
$pgtitle = array(gettext("Interfaces"), gettext("PPPs"));
79
$shortcut_section = "interfaces";
80
include("head.inc");
81

    
82
$tab_array = array();
83
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
84
$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
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
90
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
91
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
92
$tab_array[] = array(gettext("LAGGs"), false, "interfaces_lagg.php");
93
display_top_tabs($tab_array);
94
?>
95
<div class="panel panel-default">
96
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('PPP Interfaces')?></h2></div>
97
	<div class="panel-body">
98
		<div class="table-responsive">
99
			<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
100
				<thead>
101
					<tr>
102
						<th><?=gettext("Interface"); ?></th>
103
						<th><?=gettext("Interface(s)/Port(s)"); ?></th>
104
						<th><?=gettext("Description"); ?></th>
105
						<th><?=gettext("Actions")?></th>
106
					</tr>
107
				</thead>
108
				<tbody>
109
<?php
110

    
111
$i = 0;
112

    
113

    
114
if (is_array($a_ppps)) {
115
	foreach ($a_ppps as $id => $ppp) {
116
?>
117
					<tr>
118
						<td>
119
							<?=htmlspecialchars($ppp['if'])?>
120
						</td>
121
						<td>
122
<?php
123
	$portlist = explode(",", $ppp['ports']);
124
	foreach ($portlist as $portid => $port) {
125
		if ($port != get_real_interface($port) && $ppp['type'] != "ppp") {
126
			$portlist[$portid] = convert_friendly_interface_to_friendly_descr($port);
127
		}
128
	}
129
							echo htmlspecialchars(implode(",", $portlist));
130
?>
131
						</td>
132
						<td>
133
							<?=htmlspecialchars($ppp['descr'])?>
134
						</td>
135
						<td>
136
							<a class="fa fa-pencil"	title="<?=gettext('Edit PPP interface')?>"	href="interfaces_ppps_edit.php?id=<?=$i?>"></a>
137
							<a class="fa fa-trash"	title="<?=gettext('Delete PPP interface')?>"	href="interfaces_ppps.php?act=del&amp;id=<?=$i?>" usepost></a>
138
						</td>
139
					</tr>
140
<?php
141
	$i++;
142
	}
143
}
144
?>
145
				</tbody>
146
			</table>
147
		</div>
148
	</div>
149
</div>
150

    
151
<nav class="action-buttons">
152
	<a href="interfaces_ppps_edit.php" class="btn btn-success btn-sm">
153
		<i class="fa fa-plus icon-embed-btn"></i>
154
		<?=gettext("Add")?>
155
	</a>
156
</nav>
157

    
158
<?php
159
include("foot.inc");
(83-83/234)