Project

General

Profile

Download (4.01 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-2013 BSD Perimeter
7
 * Copyright (c) 2013-2016 Electric Sheep Fencing
8
 * Copyright (c) 2014-2020 Rubicon Communications, LLC (Netgate)
9
 * All rights reserved.
10
 *
11
 * 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
 *
15
 * http://www.apache.org/licenses/LICENSE-2.0
16
 *
17
 * 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
 */
23

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

    
31
require_once("guiconfig.inc");
32
require_once("filter.inc");
33
require_once("vpn.inc");
34

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

    
38

    
39
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
				foreach ($config['pppoes']['pppoe'] as $pppoe) {
48
					if ($pppoe['pppoeid'] == $pppoeid) {
49
						vpn_pppoe_configure($pppoe);
50
						break;
51
					}
52
				}
53
			}
54
		}
55
		@unlink("{$g['tmp_path']}/.vpn_pppoe.apply");
56
	}
57
	$retval = 0;
58
	$retval |= filter_configure();
59
	clear_subsystem_dirty('vpnpppoe');
60
}
61

    
62
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
		}
67
		if (is_dir("{$g['varetc_path']}/pppoe" . $a_pppoes[$_POST['id']]['pppoeid'])) {
68
			mwexec("/bin/rm -r {$g['varetc_path']}/pppoe" . $a_pppoes[$_POST['id']]['pppoeid']);
69
		}
70
		unset($a_pppoes[$_POST['id']]);
71
		write_config();
72
		header("Location: services_pppoe.php");
73
		exit;
74
	}
75
}
76

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

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

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

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

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

    
136
	</div>
137
</div>
138

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

    
146
<?php
147
include("foot.inc");
(138-138/230)