Project

General

Profile

Download (4.73 KB) Statistics
| Branch: | Tag: | Revision:
1 589f92bb gnhb
<?php
2
/* $Id$ */
3
/*
4 42809b4a gnhb
	interfaces_ppps.php
5 589f92bb gnhb
	part of m0n0wall (http://m0n0.ch/wall)
6
7 ce77a9c4 Phil Davis
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
8 589f92bb gnhb
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
9
	All rights reserved.
10
11
	Redistribution and use in source and binary forms, with or without
12
	modification, are permitted provided that the following conditions are met:
13
14
	1. Redistributions of source code must retain the above copyright notice,
15
	   this list of conditions and the following disclaimer.
16
17
	2. Redistributions in binary form must reproduce the above copyright
18
	   notice, this list of conditions and the following disclaimer in the
19
	   documentation and/or other materials provided with the distribution.
20
21
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
22
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
23
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
25
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
	POSSIBILITY OF SUCH DAMAGE.
31
*/
32
/*
33
	pfSense_BUILDER_BINARIES:	/sbin/ifconfig
34 68a7712c sbeaver
	pfSense_MODULE: interfaces
35 589f92bb gnhb
*/
36
37
##|+PRIV
38 42809b4a gnhb
##|*IDENT=page-interfaces-ppps
39
##|*NAME=Interfaces: ppps page
40
##|*DESCR=Allow access to the 'Interfaces: ppps' page.
41
##|*MATCH=interfaces_ppps.php*
42 589f92bb gnhb
##|-PRIV
43
44
require("guiconfig.inc");
45 cfb9eb9f Carlos Eduardo Ramos
require_once("functions.inc");
46 589f92bb gnhb
47 e51cea69 gnhb
function ppp_inuse($num) {
48 c5ce8398 jim-p
	global $config, $g;
49 006d23d4 sbeaver
50 42809b4a gnhb
	$iflist = get_configured_interface_list(false, true);
51 2af86dda Phil Davis
	if (!is_array($config['ppps']['ppp'])) {
52 c5ce8398 jim-p
		return false;
53 2af86dda Phil Davis
	}
54 c5ce8398 jim-p
55 42809b4a gnhb
	foreach ($iflist as $if) {
56 2af86dda Phil Davis
		if ($config['interfaces'][$if]['if'] == $config['ppps']['ppp'][$num]['if']) {
57 42809b4a gnhb
			return true;
58 2af86dda Phil Davis
		}
59 42809b4a gnhb
	}
60 006d23d4 sbeaver
61 42809b4a gnhb
	return false;
62 589f92bb gnhb
}
63
64
if ($_GET['act'] == "del") {
65
	/* check if still in use */
66 e51cea69 gnhb
	if (ppp_inuse($_GET['id'])) {
67 f2047bd0 Rafael Lucas
		$input_errors[] = gettext("This point-to-point link cannot be deleted because it is still being used as an interface.");
68 c5ce8398 jim-p
	} elseif (is_array($config['ppps']['ppp']) && is_array($config['ppps']['ppp'][$_GET['id']])) {
69
70
		unset($config['ppps']['ppp'][$_GET['id']]['pppoe-reset-type']);
71
		handle_pppoe_reset($config['ppps']['ppp'][$_GET['id']]);
72
		unset($config['ppps']['ppp'][$_GET['id']]);
73 589f92bb gnhb
		write_config();
74 42809b4a gnhb
		header("Location: interfaces_ppps.php");
75 589f92bb gnhb
		exit;
76
	}
77
}
78
79 2af86dda Phil Davis
if (!is_array($config['ppps']['ppp'])) {
80 c5ce8398 jim-p
	$config['ppps']['ppp'] = array();
81 2af86dda Phil Davis
}
82 c5ce8398 jim-p
$a_ppps = $config['ppps']['ppp'];
83
84 68a7712c sbeaver
$pgtitle = array(gettext("Interfaces"),gettext("PPPs"));
85 b32dd0a6 jim-p
$shortcut_section = "interfaces";
86 589f92bb gnhb
include("head.inc");
87
88 68a7712c sbeaver
$tab_array = array();
89 006d23d4 sbeaver
$tab_array[] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
90
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
91
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
92
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
93
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
94
$tab_array[] = array(gettext("PPPs"), true, "interfaces_ppps.php");
95
$tab_array[] = array(gettext("GRE"), false, "interfaces_gre.php");
96
$tab_array[] = array(gettext("GIF"), false, "interfaces_gif.php");
97
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
98
$tab_array[] = array(gettext("LAGG"), false, "interfaces_lagg.php");
99 68a7712c sbeaver
display_top_tabs($tab_array);
100 589f92bb gnhb
?>
101 68a7712c sbeaver
<div class="table-responsive">
102
	<table class="table table-striped table-hover table-condensed">
103
		<thead>
104
			<tr>
105
			  <th><?=gettext("Interface"); ?></th>
106
			  <th><?=gettext("Interface(s)/Port(s)"); ?></th>
107
			  <th><?=gettext("Description"); ?></th>
108
			  <th></th>
109
			</tr>
110
		</thead>
111
		<tbody>
112
<?php
113
114
$i = 0;
115 589f92bb gnhb
116 68a7712c sbeaver
foreach ($a_ppps as $id => $ppp) {
117
?>
118 006d23d4 sbeaver
			<tr>
119 68a7712c sbeaver
				<td>
120
					<?=htmlspecialchars($ppp['if'])?>
121
				</td>
122
				<td>
123
<?php
124
	$portlist = explode(",", $ppp['ports']);
125
	foreach ($portlist as $portid => $port) {
126
		if ($port != get_real_interface($port) && $ppp['type'] != "ppp")
127
			$portlist[$portid] = convert_friendly_interface_to_friendly_descr($port);
128
	}
129
					echo htmlspecialchars(implode(",", $portlist));
130
?>
131
				</td>
132
				<td>
133
					<?=htmlspecialchars($ppp['descr'])?>
134
				</td>
135
				<td>
136
					<a href="interfaces_ppps_edit.php?id=<?=$i?>" class="btn btn-default btn-xs"><?=gettext("Edit")?></a>
137
					<a href="interfaces_ppps.php?act=del&amp;id=<?=$i?>" class="btn btn-danger btn-xs"><?=gettext("Delete")?></a>
138
				</td>
139
			</tr>
140 589f92bb gnhb
<?php
141 68a7712c sbeaver
	$i++;
142
}
143 589f92bb gnhb
?>
144 68a7712c sbeaver
		</tbody>
145
	</table>
146 006d23d4 sbeaver
147
	<nav class="action-buttons">
148
	   <a href="interfaces_ppps_edit.php" class="btn btn-success"><?=gettext("Add")?></a>
149
	</nav>
150 68a7712c sbeaver
</div>
151
<?php
152
include("foot.inc");