Project

General

Profile

Download (3.92 KB) Statistics
| Branch: | Tag: | Revision:
1 3818935a Scott Ullrich
<?php
2
/*
3 c5d81585 Renato Botelho
 * services_pppoe.php
4 b9043cdc Stephen Beaver
 *
5 c5d81585 Renato Botelho
 * part of pfSense (https://www.pfsense.org)
6 0b4c14a4 Steve Beaver
 * Copyright (c) 2004-2019 Rubicon Communications, LLC (Netgate)
7 c5d81585 Renato Botelho
 * All rights reserved.
8 b9043cdc Stephen Beaver
 *
9 b12ea3fb Renato Botelho
 * Licensed under the Apache License, Version 2.0 (the "License");
10
 * you may not use this file except in compliance with the License.
11
 * You may obtain a copy of the License at
12 b9043cdc Stephen Beaver
 *
13 b12ea3fb Renato Botelho
 * http://www.apache.org/licenses/LICENSE-2.0
14 b9043cdc Stephen Beaver
 *
15 b12ea3fb Renato Botelho
 * Unless required by applicable law or agreed to in writing, software
16
 * distributed under the License is distributed on an "AS IS" BASIS,
17
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
 * See the License for the specific language governing permissions and
19
 * limitations under the License.
20 b9043cdc Stephen Beaver
 */
21 3818935a Scott Ullrich
22 6b07c15a Matthew Grooms
##|+PRIV
23
##|*IDENT=page-services-pppoeserver
24 5230f468 jim-p
##|*NAME=Services: PPPoE Server
25 6b07c15a Matthew Grooms
##|*DESCR=Allow access to the 'Services: PPPoE Server' page.
26 1af5edbf Stephen Beaver
##|*MATCH=services_pppoe.php*
27 6b07c15a Matthew Grooms
##|-PRIV
28
29 0e642c78 Ermal
require_once("guiconfig.inc");
30
require_once("filter.inc");
31 483e6de8 Scott Ullrich
require_once("vpn.inc");
32 3818935a Scott Ullrich
33 c6c398c6 jim-p
init_config_arr(array('pppoes', 'pppoe'));
34 0e642c78 Ermal
$a_pppoes = &$config['pppoes']['pppoe'];
35 3818935a Scott Ullrich
36 0e642c78 Ermal
37 13541a81 Steve Beaver
if ($_POST['apply']) {
38
	if (file_exists("{$g['tmp_path']}/.vpn_pppoe.apply")) {
39
		$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.vpn_pppoe.apply"));
40
		foreach ($toapplylist as $pppoeid) {
41
			if (!is_numeric($pppoeid)) {
42
				continue;
43
			}
44
			if (is_array($config['pppoes']['pppoe'])) {
45
				foreach ($config['pppoes']['pppoe'] as $pppoe) {
46
					if ($pppoe['pppoeid'] == $pppoeid) {
47
						vpn_pppoe_configure($pppoe);
48
						break;
49 0e642c78 Ermal
					}
50
				}
51 4c8c4fc2 sbeaver
			}
52
		}
53 13541a81 Steve Beaver
		@unlink("{$g['tmp_path']}/.vpn_pppoe.apply");
54 4c8c4fc2 sbeaver
	}
55 13541a81 Steve Beaver
	$retval = 0;
56
	$retval |= filter_configure();
57
	clear_subsystem_dirty('vpnpppoe');
58 0e642c78 Ermal
}
59 3818935a Scott Ullrich
60 13541a81 Steve Beaver
if ($_POST['act'] == "del") {
61
	if ($a_pppoes[$_POST['id']]) {
62
		if ("{$g['varrun_path']}/pppoe" . $a_pppoes[$_POST['id']]['pppoeid'] . "-vpn.pid") {
63
			killbypid("{$g['varrun_path']}/pppoe" . $a_pppoes[$_POST['id']]['pppoeid'] . "-vpn.pid");
64 b7856e58 Phil Davis
		}
65 13541a81 Steve Beaver
		if (is_dir("{$g['varetc_path']}/pppoe" . $a_pppoes[$_POST['id']]['pppoeid'])) {
66
			mwexec("/bin/rm -r {$g['varetc_path']}/pppoe" . $a_pppoes[$_POST['id']]['pppoeid']);
67 b7856e58 Phil Davis
		}
68 13541a81 Steve Beaver
		unset($a_pppoes[$_POST['id']]);
69 3818935a Scott Ullrich
		write_config();
70 1af5edbf Stephen Beaver
		header("Location: services_pppoe.php");
71 0e642c78 Ermal
		exit;
72 3818935a Scott Ullrich
	}
73
}
74
75 20db3e1a Phil Davis
$pgtitle = array(gettext("Services"), gettext("PPPoE Server"));
76 b32dd0a6 jim-p
$shortcut_section = "pppoes";
77 3818935a Scott Ullrich
include("head.inc");
78
79 44c42356 Phil Davis
if ($_POST['apply']) {
80
	print_apply_result_box($retval);
81 20db3e1a Phil Davis
}
82 4c8c4fc2 sbeaver
83 20db3e1a Phil Davis
if (is_subsystem_dirty('vpnpppoe')) {
84 c4118eac NOYB
	print_apply_box(gettext('The PPPoE entry list has been changed.') . '<br />' . gettext('The changes must be applied for them to take effect.'));
85 20db3e1a Phil Davis
}
86 3818935a Scott Ullrich
?>
87
88 ac950976 Colin Fleming
<div class="panel panel-default">
89
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('PPPoE Server')?></h2></div>
90
	<div class="panel-body">
91 13541a81 Steve Beaver
92 ac950976 Colin Fleming
	<div class="table-responsive">
93 1c10ce97 PiBa-NL
	<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
94 66bbb1b5 Sjon Hortensius
		<thead>
95
			<tr>
96
				<th><?=gettext("Interface")?></th>
97
				<th><?=gettext("Local IP")?></th>
98
				<th><?=gettext("Number of users")?></th>
99
				<th><?=gettext("Description")?></th>
100 70dc5cd6 Phil Davis
				<th><?=gettext("Actions")?></th>
101 66bbb1b5 Sjon Hortensius
			</tr>
102
		</thead>
103
		<tbody>
104 4c8c4fc2 sbeaver
<?php
105
$i = 0;
106
foreach ($a_pppoes as $pppoe):
107
?>
108 66bbb1b5 Sjon Hortensius
			<tr>
109
				<td>
110
					<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($pppoe['interface']))?>
111
				</td>
112
				<td>
113
					<?=htmlspecialchars($pppoe['localip'])?>
114
				</td>
115
				<td>
116
					<?=htmlspecialchars($pppoe['n_pppoe_units'])?>
117
				</td>
118
				<td>
119
					<?=htmlspecialchars($pppoe['descr'])?>
120
				</td>
121
				<td>
122 1af5edbf Stephen Beaver
					<a class="fa fa-pencil"	title="<?=gettext('Edit PPPoE instance')?>"	href="services_pppoe_edit.php?id=<?=$i?>"></a>
123 13541a81 Steve Beaver
					<a class="fa fa-trash" title="<?=gettext('Delete PPPoE instance')?>" href="services_pppoe.php?act=del&amp;id=<?=$i?>" usepost></a>
124 7657b650 heper
				</td>
125 66bbb1b5 Sjon Hortensius
			</tr>
126 4c8c4fc2 sbeaver
<?php
127
	$i++;
128
endforeach;
129
?>
130 66bbb1b5 Sjon Hortensius
		</tbody>
131
	</table>
132
</div>
133
134 ac950976 Colin Fleming
	</div>
135
</div>
136
137 c10cb196 Stephen Beaver
<nav class="action-buttons">
138 1af5edbf Stephen Beaver
	<a href="services_pppoe_edit.php" class="btn btn-success">
139 9d5a20cf heper
		<i class="fa fa-plus icon-embed-btn"></i>
140 b921ab63 Stephen Beaver
		<?=gettext("Add")?>
141
	</a>
142 66bbb1b5 Sjon Hortensius
</nav>
143
144 4c8c4fc2 sbeaver
<?php
145 32dc1497 heper
include("foot.inc");