Project

General

Profile

Download (5.67 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
	pfSense_MODULE:	interfaces
35
*/
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 42809b4a gnhb
	$iflist = get_configured_interface_list(false, true);
50 2af86dda Phil Davis
	if (!is_array($config['ppps']['ppp'])) {
51 c5ce8398 jim-p
		return false;
52 2af86dda Phil Davis
	}
53 c5ce8398 jim-p
54 42809b4a gnhb
	foreach ($iflist as $if) {
55 2af86dda Phil Davis
		if ($config['interfaces'][$if]['if'] == $config['ppps']['ppp'][$num]['if']) {
56 42809b4a gnhb
			return true;
57 2af86dda Phil Davis
		}
58 42809b4a gnhb
	}
59
	return false;
60 589f92bb gnhb
}
61
62
if ($_GET['act'] == "del") {
63
	/* check if still in use */
64 e51cea69 gnhb
	if (ppp_inuse($_GET['id'])) {
65 f2047bd0 Rafael Lucas
		$input_errors[] = gettext("This point-to-point link cannot be deleted because it is still being used as an interface.");
66 c5ce8398 jim-p
	} elseif (is_array($config['ppps']['ppp']) && is_array($config['ppps']['ppp'][$_GET['id']])) {
67
68
		unset($config['ppps']['ppp'][$_GET['id']]['pppoe-reset-type']);
69
		handle_pppoe_reset($config['ppps']['ppp'][$_GET['id']]);
70
		unset($config['ppps']['ppp'][$_GET['id']]);
71 589f92bb gnhb
		write_config();
72 42809b4a gnhb
		header("Location: interfaces_ppps.php");
73 589f92bb gnhb
		exit;
74
	}
75
}
76
77 2af86dda Phil Davis
if (!is_array($config['ppps']['ppp'])) {
78 c5ce8398 jim-p
	$config['ppps']['ppp'] = array();
79 2af86dda Phil Davis
}
80 c5ce8398 jim-p
$a_ppps = $config['ppps']['ppp'];
81
82 f2047bd0 Rafael Lucas
$pgtitle = gettext("Interfaces: PPPs");
83 b32dd0a6 jim-p
$shortcut_section = "interfaces";
84 589f92bb gnhb
include("head.inc");
85
86
?>
87
88
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
89
<?php include("fbegin.inc"); ?>
90
<?php if ($input_errors) print_input_errors($input_errors); ?>
91 168d8b07 Colin Fleming
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="interfaces ppps">
92 2af86dda Phil Davis
	<tr><td>
93 589f92bb gnhb
<?php
94
	$tab_array = array();
95 f2047bd0 Rafael Lucas
	$tab_array[0] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
96
	$tab_array[1] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
97
	$tab_array[2] = array(gettext("Wireless"), false, "interfaces_wireless.php");
98
	$tab_array[3] = array(gettext("VLANs"), false, "interfaces_vlan.php");
99
	$tab_array[4] = array(gettext("QinQs"), false, "interfaces_qinq.php");
100
	$tab_array[5] = array(gettext("PPPs"), true, "interfaces_ppps.php");
101
	$tab_array[6] = array(gettext("GRE"), false, "interfaces_gre.php");
102
	$tab_array[7] = array(gettext("GIF"), false, "interfaces_gif.php");
103
	$tab_array[8] = array(gettext("Bridges"), false, "interfaces_bridge.php");
104
	$tab_array[9] = array(gettext("LAGG"), false, "interfaces_lagg.php");
105 589f92bb gnhb
	display_top_tabs($tab_array);
106
?>
107 2af86dda Phil Davis
	</td></tr>
108
	<tr>
109
		<td>
110
			<div id="mainarea">
111
			<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
112
				<tr>
113
					<td width="20%" class="listhdrr"><?=gettext("Interface");?></td>
114
					<td width="20%" class="listhdrr"><?=gettext("Interface(s)/Port(s)");?></td>
115
					<td width="40%" class="listhdr"><?=gettext("Description");?></td>
116
					<td width="10%" class="list"></td>
117 589f92bb gnhb
				</tr>
118 2af86dda Phil Davis
<?php
119
	$i = 0;
120
	foreach ($a_ppps as $id => $ppp):
121
?>
122
				<tr  ondblclick="document.location='interfaces_ppps_edit.php?id=<?=$i;?>'">
123
					<td class="listr">
124
						<?=htmlspecialchars($ppp['if']);?>
125
					</td>
126
					<td class="listr">
127
<?php
128
		$portlist = explode(",", $ppp['ports']);
129
		foreach ($portlist as $portid => $port) {
130
			if ($port != get_real_interface($port) && $ppp['type'] != "ppp") {
131
				$portlist[$portid] = convert_friendly_interface_to_friendly_descr($port);
132
			}
133
		}
134
		echo htmlspecialchars(implode(",", $portlist));
135
?>
136
					</td>
137
					<td class="listbg">
138
						<?=htmlspecialchars($ppp['descr']);?>&nbsp;
139
					</td>
140
					<td valign="middle" class="list nowrap"> <a href="interfaces_ppps_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" alt="edit" /></a>
141
						&nbsp;<a href="interfaces_ppps.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this PPP interface?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="remove" /></a>
142
					</td>
143 589f92bb gnhb
				</tr>
144 2af86dda Phil Davis
<?php
145
		$i++;
146
	endforeach;
147
?>
148
				<tr>
149
					<td class="list" colspan="3">&nbsp;</td>
150
					<td class="list"> <a href="interfaces_ppps_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="add" /></a></td>
151 589f92bb gnhb
				</tr>
152 2af86dda Phil Davis
			</table>
153
			</div>
154
		</td>
155 589f92bb gnhb
	</tr>
156
</table>
157
<?php include("fend.inc"); ?>
158
</body>
159
</html>