Project

General

Profile

Download (4.47 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
 * 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(false, 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 ($_GET['act'] == "del") {
54
	/* check if still in use */
55
	if (ppp_inuse($_GET['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'][$_GET['id']])) {
58

    
59
		unset($config['ppps']['ppp'][$_GET['id']]['pppoe-reset-type']);
60
		handle_pppoe_reset($config['ppps']['ppp'][$_GET['id']]);
61
		unset($config['ppps']['ppp'][$_GET['id']]);
62
		write_config();
63
		header("Location: interfaces_ppps.php");
64
		exit;
65
	}
66
}
67

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

    
73
$pgtitle = array(gettext("Interfaces"), gettext("PPPs"));
74
$shortcut_section = "interfaces";
75
include("head.inc");
76

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

    
106
$i = 0;
107

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

    
143
<nav class="action-buttons">
144
	<a href="interfaces_ppps_edit.php" class="btn btn-success btn-sm">
145
		<i class="fa fa-plus icon-embed-btn"></i>
146
		<?=gettext("Add")?>
147
	</a>
148
</nav>
149

    
150
<?php
151
include("foot.inc");
152

    
(77-77/223)