Project

General

Profile

Download (4.01 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 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
if ($_POST) {
40 4c8c4fc2 sbeaver
	$pconfig = $_POST;
41 0e642c78 Ermal
42 4c8c4fc2 sbeaver
	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 b7856e58 Phil Davis
				if (!is_numeric($pppoeid)) {
47 0e642c78 Ermal
					continue;
48 b7856e58 Phil Davis
				}
49 0e642c78 Ermal
				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 4c8c4fc2 sbeaver
			}
58
			@unlink("{$g['tmp_path']}/.vpn_pppoe.apply");
59
		}
60
		$retval = 0;
61
		$retval |= filter_configure();
62
		clear_subsystem_dirty('vpnpppoe');
63
	}
64 0e642c78 Ermal
}
65 3818935a Scott Ullrich
66 0e642c78 Ermal
if ($_GET['act'] == "del") {
67
	if ($a_pppoes[$_GET['id']]) {
68 b7856e58 Phil Davis
		if ("{$g['varrun_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid'] . "-vpn.pid") {
69 0e642c78 Ermal
			killbypid("{$g['varrun_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid'] . "-vpn.pid");
70 b7856e58 Phil Davis
		}
71
		if (is_dir("{$g['varetc_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid'])) {
72 61223023 Ermal
			mwexec("/bin/rm -r {$g['varetc_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid']);
73 b7856e58 Phil Davis
		}
74 0e642c78 Ermal
		unset($a_pppoes[$_GET['id']]);
75 3818935a Scott Ullrich
		write_config();
76 1af5edbf Stephen Beaver
		header("Location: services_pppoe.php");
77 0e642c78 Ermal
		exit;
78 3818935a Scott Ullrich
	}
79
}
80
81 20db3e1a Phil Davis
$pgtitle = array(gettext("Services"), gettext("PPPoE Server"));
82 b32dd0a6 jim-p
$shortcut_section = "pppoes";
83 3818935a Scott Ullrich
include("head.inc");
84
85 44c42356 Phil Davis
if ($_POST['apply']) {
86
	print_apply_result_box($retval);
87 20db3e1a Phil Davis
}
88 4c8c4fc2 sbeaver
89 20db3e1a Phil Davis
if (is_subsystem_dirty('vpnpppoe')) {
90 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.'));
91 20db3e1a Phil Davis
}
92 3818935a Scott Ullrich
?>
93
94 ac950976 Colin Fleming
<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 1c10ce97 PiBa-NL
	<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
100 66bbb1b5 Sjon Hortensius
		<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 70dc5cd6 Phil Davis
				<th><?=gettext("Actions")?></th>
107 66bbb1b5 Sjon Hortensius
			</tr>
108
		</thead>
109
		<tbody>
110 4c8c4fc2 sbeaver
<?php
111
$i = 0;
112
foreach ($a_pppoes as $pppoe):
113
?>
114 66bbb1b5 Sjon Hortensius
			<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 1af5edbf Stephen Beaver
					<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 7657b650 heper
				</td>
131 66bbb1b5 Sjon Hortensius
			</tr>
132 4c8c4fc2 sbeaver
<?php
133
	$i++;
134
endforeach;
135
?>
136 66bbb1b5 Sjon Hortensius
		</tbody>
137
	</table>
138
</div>
139
140 ac950976 Colin Fleming
	</div>
141
</div>
142
143 c10cb196 Stephen Beaver
<nav class="action-buttons">
144 1af5edbf Stephen Beaver
	<a href="services_pppoe_edit.php" class="btn btn-success">
145 9d5a20cf heper
		<i class="fa fa-plus icon-embed-btn"></i>
146 b921ab63 Stephen Beaver
		<?=gettext("Add")?>
147
	</a>
148 66bbb1b5 Sjon Hortensius
</nav>
149
150 4c8c4fc2 sbeaver
<?php
151 32dc1497 heper
include("foot.inc");