Project

General

Profile

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