Project

General

Profile

Download (3.92 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
 * services_pppoe.php
4
 *
5
 * part of pfSense (https://www.pfsense.org)
6
 * Copyright (c) 2004-2020 Rubicon Communications, LLC (Netgate)
7
 * All rights reserved.
8
 *
9
 * 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
 *
13
 * http://www.apache.org/licenses/LICENSE-2.0
14
 *
15
 * 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
 */
21

    
22
##|+PRIV
23
##|*IDENT=page-services-pppoeserver
24
##|*NAME=Services: PPPoE Server
25
##|*DESCR=Allow access to the 'Services: PPPoE Server' page.
26
##|*MATCH=services_pppoe.php*
27
##|-PRIV
28

    
29
require_once("guiconfig.inc");
30
require_once("filter.inc");
31
require_once("vpn.inc");
32

    
33
init_config_arr(array('pppoes', 'pppoe'));
34
$a_pppoes = &$config['pppoes']['pppoe'];
35

    
36

    
37
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
					}
50
				}
51
			}
52
		}
53
		@unlink("{$g['tmp_path']}/.vpn_pppoe.apply");
54
	}
55
	$retval = 0;
56
	$retval |= filter_configure();
57
	clear_subsystem_dirty('vpnpppoe');
58
}
59

    
60
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
		}
65
		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
		}
68
		unset($a_pppoes[$_POST['id']]);
69
		write_config();
70
		header("Location: services_pppoe.php");
71
		exit;
72
	}
73
}
74

    
75
$pgtitle = array(gettext("Services"), gettext("PPPoE Server"));
76
$shortcut_section = "pppoes";
77
include("head.inc");
78

    
79
if ($_POST['apply']) {
80
	print_apply_result_box($retval);
81
}
82

    
83
if (is_subsystem_dirty('vpnpppoe')) {
84
	print_apply_box(gettext('The PPPoE entry list has been changed.') . '<br />' . gettext('The changes must be applied for them to take effect.'));
85
}
86
?>
87

    
88
<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

    
92
	<div class="table-responsive">
93
	<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
94
		<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
				<th><?=gettext("Actions")?></th>
101
			</tr>
102
		</thead>
103
		<tbody>
104
<?php
105
$i = 0;
106
foreach ($a_pppoes as $pppoe):
107
?>
108
			<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
					<a class="fa fa-pencil"	title="<?=gettext('Edit PPPoE instance')?>"	href="services_pppoe_edit.php?id=<?=$i?>"></a>
123
					<a class="fa fa-trash" title="<?=gettext('Delete PPPoE instance')?>" href="services_pppoe.php?act=del&amp;id=<?=$i?>" usepost></a>
124
				</td>
125
			</tr>
126
<?php
127
	$i++;
128
endforeach;
129
?>
130
		</tbody>
131
	</table>
132
</div>
133

    
134
	</div>
135
</div>
136

    
137
<nav class="action-buttons">
138
	<a href="services_pppoe_edit.php" class="btn btn-success">
139
		<i class="fa fa-plus icon-embed-btn"></i>
140
		<?=gettext("Add")?>
141
	</a>
142
</nav>
143

    
144
<?php
145
include("foot.inc");
(142-142/235)