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-2016 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
if (!is_array($config['pppoes']['pppoe'])) {
34
	$config['pppoes']['pppoe'] = array();
35
}
36

    
37
$a_pppoes = &$config['pppoes']['pppoe'];
38

    
39
if ($_POST) {
40
	$pconfig = $_POST;
41

    
42
	if ($_POST['apply']) {
43
		if (file_exists("{$g['tmp_path']}/.vpn_pppoe.apply")) {
44
			$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.vpn_pppoe.apply"));
45
			foreach ($toapplylist as $pppoeid) {
46
				if (!is_numeric($pppoeid)) {
47
					continue;
48
				}
49
				if (is_array($config['pppoes']['pppoe'])) {
50
					foreach ($config['pppoes']['pppoe'] as $pppoe) {
51
						if ($pppoe['pppoeid'] == $pppoeid) {
52
							vpn_pppoe_configure($pppoe);
53
							break;
54
						}
55
					}
56
				}
57
			}
58
			@unlink("{$g['tmp_path']}/.vpn_pppoe.apply");
59
		}
60
		$retval = 0;
61
		$retval |= filter_configure();
62
		clear_subsystem_dirty('vpnpppoe');
63
	}
64
}
65

    
66
if ($_GET['act'] == "del") {
67
	if ($a_pppoes[$_GET['id']]) {
68
		if ("{$g['varrun_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid'] . "-vpn.pid") {
69
			killbypid("{$g['varrun_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid'] . "-vpn.pid");
70
		}
71
		if (is_dir("{$g['varetc_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid'])) {
72
			mwexec("/bin/rm -r {$g['varetc_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid']);
73
		}
74
		unset($a_pppoes[$_GET['id']]);
75
		write_config();
76
		header("Location: services_pppoe.php");
77
		exit;
78
	}
79
}
80

    
81
$pgtitle = array(gettext("Services"), gettext("PPPoE Server"));
82
$shortcut_section = "pppoes";
83
include("head.inc");
84

    
85
if ($_POST['apply']) {
86
	print_apply_result_box($retval);
87
}
88

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

    
94
<div class="panel panel-default">
95
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('PPPoE Server')?></h2></div>
96
	<div class="panel-body">
97
	
98
	<div class="table-responsive">
99
	<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
100
		<thead>
101
			<tr>
102
				<th><?=gettext("Interface")?></th>
103
				<th><?=gettext("Local IP")?></th>
104
				<th><?=gettext("Number of users")?></th>
105
				<th><?=gettext("Description")?></th>
106
				<th><?=gettext("Actions")?></th>
107
			</tr>
108
		</thead>
109
		<tbody>
110
<?php
111
$i = 0;
112
foreach ($a_pppoes as $pppoe):
113
?>
114
			<tr>
115
				<td>
116
					<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($pppoe['interface']))?>
117
				</td>
118
				<td>
119
					<?=htmlspecialchars($pppoe['localip'])?>
120
				</td>
121
				<td>
122
					<?=htmlspecialchars($pppoe['n_pppoe_units'])?>
123
				</td>
124
				<td>
125
					<?=htmlspecialchars($pppoe['descr'])?>
126
				</td>
127
				<td>
128
					<a class="fa fa-pencil"	title="<?=gettext('Edit PPPoE instance')?>"	href="services_pppoe_edit.php?id=<?=$i?>"></a>
129
					<a class="fa fa-trash" title="<?=gettext('Delete PPPoE instance')?>" href="services_pppoe.php?act=del&amp;id=<?=$i?>"></a>
130
				</td>
131
			</tr>
132
<?php
133
	$i++;
134
endforeach;
135
?>
136
		</tbody>
137
	</table>
138
</div>
139

    
140
	</div>
141
</div>
142

    
143
<nav class="action-buttons">
144
	<a href="services_pppoe_edit.php" class="btn btn-success">
145
		<i class="fa fa-plus icon-embed-btn"></i>
146
		<?=gettext("Add")?>
147
	</a>
148
</nav>
149

    
150
<?php
151
include("foot.inc");
(132-132/223)