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 |
81299b5c
|
Renato Botelho
|
* Copyright (c) 2004-2016 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 |
b7856e58
|
Phil Davis
|
if (!is_array($config['pppoes']['pppoe'])) {
|
34 |
0e642c78
|
Ermal
|
$config['pppoes']['pppoe'] = array();
|
35 |
b7856e58
|
Phil Davis
|
}
|
36 |
c8c416db
|
Scott Ullrich
|
|
37 |
0e642c78
|
Ermal
|
$a_pppoes = &$config['pppoes']['pppoe'];
|
38 |
3818935a
|
Scott Ullrich
|
|
39 |
0e642c78
|
Ermal
|
|
40 |
13541a81
|
Steve Beaver
|
if ($_POST['apply']) {
|
41 |
|
|
if (file_exists("{$g['tmp_path']}/.vpn_pppoe.apply")) {
|
42 |
|
|
$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.vpn_pppoe.apply"));
|
43 |
|
|
foreach ($toapplylist as $pppoeid) {
|
44 |
|
|
if (!is_numeric($pppoeid)) {
|
45 |
|
|
continue;
|
46 |
|
|
}
|
47 |
|
|
if (is_array($config['pppoes']['pppoe'])) {
|
48 |
|
|
foreach ($config['pppoes']['pppoe'] as $pppoe) {
|
49 |
|
|
if ($pppoe['pppoeid'] == $pppoeid) {
|
50 |
|
|
vpn_pppoe_configure($pppoe);
|
51 |
|
|
break;
|
52 |
0e642c78
|
Ermal
|
}
|
53 |
|
|
}
|
54 |
4c8c4fc2
|
sbeaver
|
}
|
55 |
|
|
}
|
56 |
13541a81
|
Steve Beaver
|
@unlink("{$g['tmp_path']}/.vpn_pppoe.apply");
|
57 |
4c8c4fc2
|
sbeaver
|
}
|
58 |
13541a81
|
Steve Beaver
|
$retval = 0;
|
59 |
|
|
$retval |= filter_configure();
|
60 |
|
|
clear_subsystem_dirty('vpnpppoe');
|
61 |
0e642c78
|
Ermal
|
}
|
62 |
3818935a
|
Scott Ullrich
|
|
63 |
13541a81
|
Steve Beaver
|
if ($_POST['act'] == "del") {
|
64 |
|
|
if ($a_pppoes[$_POST['id']]) {
|
65 |
|
|
if ("{$g['varrun_path']}/pppoe" . $a_pppoes[$_POST['id']]['pppoeid'] . "-vpn.pid") {
|
66 |
|
|
killbypid("{$g['varrun_path']}/pppoe" . $a_pppoes[$_POST['id']]['pppoeid'] . "-vpn.pid");
|
67 |
b7856e58
|
Phil Davis
|
}
|
68 |
13541a81
|
Steve Beaver
|
if (is_dir("{$g['varetc_path']}/pppoe" . $a_pppoes[$_POST['id']]['pppoeid'])) {
|
69 |
|
|
mwexec("/bin/rm -r {$g['varetc_path']}/pppoe" . $a_pppoes[$_POST['id']]['pppoeid']);
|
70 |
b7856e58
|
Phil Davis
|
}
|
71 |
13541a81
|
Steve Beaver
|
unset($a_pppoes[$_POST['id']]);
|
72 |
3818935a
|
Scott Ullrich
|
write_config();
|
73 |
1af5edbf
|
Stephen Beaver
|
header("Location: services_pppoe.php");
|
74 |
0e642c78
|
Ermal
|
exit;
|
75 |
3818935a
|
Scott Ullrich
|
}
|
76 |
|
|
}
|
77 |
|
|
|
78 |
20db3e1a
|
Phil Davis
|
$pgtitle = array(gettext("Services"), gettext("PPPoE Server"));
|
79 |
b32dd0a6
|
jim-p
|
$shortcut_section = "pppoes";
|
80 |
3818935a
|
Scott Ullrich
|
include("head.inc");
|
81 |
|
|
|
82 |
44c42356
|
Phil Davis
|
if ($_POST['apply']) {
|
83 |
|
|
print_apply_result_box($retval);
|
84 |
20db3e1a
|
Phil Davis
|
}
|
85 |
4c8c4fc2
|
sbeaver
|
|
86 |
20db3e1a
|
Phil Davis
|
if (is_subsystem_dirty('vpnpppoe')) {
|
87 |
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.'));
|
88 |
20db3e1a
|
Phil Davis
|
}
|
89 |
3818935a
|
Scott Ullrich
|
?>
|
90 |
|
|
|
91 |
ac950976
|
Colin Fleming
|
<div class="panel panel-default">
|
92 |
|
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext('PPPoE Server')?></h2></div>
|
93 |
|
|
<div class="panel-body">
|
94 |
13541a81
|
Steve Beaver
|
|
95 |
ac950976
|
Colin Fleming
|
<div class="table-responsive">
|
96 |
1c10ce97
|
PiBa-NL
|
<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
|
97 |
66bbb1b5
|
Sjon Hortensius
|
<thead>
|
98 |
|
|
<tr>
|
99 |
|
|
<th><?=gettext("Interface")?></th>
|
100 |
|
|
<th><?=gettext("Local IP")?></th>
|
101 |
|
|
<th><?=gettext("Number of users")?></th>
|
102 |
|
|
<th><?=gettext("Description")?></th>
|
103 |
70dc5cd6
|
Phil Davis
|
<th><?=gettext("Actions")?></th>
|
104 |
66bbb1b5
|
Sjon Hortensius
|
</tr>
|
105 |
|
|
</thead>
|
106 |
|
|
<tbody>
|
107 |
4c8c4fc2
|
sbeaver
|
<?php
|
108 |
|
|
$i = 0;
|
109 |
|
|
foreach ($a_pppoes as $pppoe):
|
110 |
|
|
?>
|
111 |
66bbb1b5
|
Sjon Hortensius
|
<tr>
|
112 |
|
|
<td>
|
113 |
|
|
<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($pppoe['interface']))?>
|
114 |
|
|
</td>
|
115 |
|
|
<td>
|
116 |
|
|
<?=htmlspecialchars($pppoe['localip'])?>
|
117 |
|
|
</td>
|
118 |
|
|
<td>
|
119 |
|
|
<?=htmlspecialchars($pppoe['n_pppoe_units'])?>
|
120 |
|
|
</td>
|
121 |
|
|
<td>
|
122 |
|
|
<?=htmlspecialchars($pppoe['descr'])?>
|
123 |
|
|
</td>
|
124 |
|
|
<td>
|
125 |
1af5edbf
|
Stephen Beaver
|
<a class="fa fa-pencil" title="<?=gettext('Edit PPPoE instance')?>" href="services_pppoe_edit.php?id=<?=$i?>"></a>
|
126 |
13541a81
|
Steve Beaver
|
<a class="fa fa-trash" title="<?=gettext('Delete PPPoE instance')?>" href="services_pppoe.php?act=del&id=<?=$i?>" usepost></a>
|
127 |
7657b650
|
heper
|
</td>
|
128 |
66bbb1b5
|
Sjon Hortensius
|
</tr>
|
129 |
4c8c4fc2
|
sbeaver
|
<?php
|
130 |
|
|
$i++;
|
131 |
|
|
endforeach;
|
132 |
|
|
?>
|
133 |
66bbb1b5
|
Sjon Hortensius
|
</tbody>
|
134 |
|
|
</table>
|
135 |
|
|
</div>
|
136 |
|
|
|
137 |
ac950976
|
Colin Fleming
|
</div>
|
138 |
|
|
</div>
|
139 |
|
|
|
140 |
c10cb196
|
Stephen Beaver
|
<nav class="action-buttons">
|
141 |
1af5edbf
|
Stephen Beaver
|
<a href="services_pppoe_edit.php" class="btn btn-success">
|
142 |
9d5a20cf
|
heper
|
<i class="fa fa-plus icon-embed-btn"></i>
|
143 |
b921ab63
|
Stephen Beaver
|
<?=gettext("Add")?>
|
144 |
|
|
</a>
|
145 |
66bbb1b5
|
Sjon Hortensius
|
</nav>
|
146 |
|
|
|
147 |
4c8c4fc2
|
sbeaver
|
<?php
|
148 |
32dc1497
|
heper
|
include("foot.inc");
|