Project

General

Profile

Download (5.71 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
 * Redistribution and use in source and binary forms, with or without
10
 * modification, are permitted provided that the following conditions are met:
11
 *
12
 * 1. Redistributions of source code must retain the above copyright notice,
13
 *    this list of conditions and the following disclaimer.
14
 *
15
 * 2. Redistributions in binary form must reproduce the above copyright
16
 *    notice, this list of conditions and the following disclaimer in
17
 *    the documentation and/or other materials provided with the
18
 *    distribution.
19
 *
20
 * 3. All advertising materials mentioning features or use of this software
21
 *    must display the following acknowledgment:
22
 *    "This product includes software developed by the pfSense Project
23
 *    for use in the pfSense® software distribution. (http://www.pfsense.org/).
24
 *
25
 * 4. The names "pfSense" and "pfSense Project" must not be used to
26
 *    endorse or promote products derived from this software without
27
 *    prior written permission. For written permission, please contact
28
 *    coreteam@pfsense.org.
29
 *
30
 * 5. Products derived from this software may not be called "pfSense"
31
 *    nor may "pfSense" appear in their names without prior written
32
 *    permission of the Electric Sheep Fencing, LLC.
33
 *
34
 * 6. Redistributions of any form whatsoever must retain the following
35
 *    acknowledgment:
36
 *
37
 * "This product includes software developed by the pfSense Project
38
 * for use in the pfSense software distribution (http://www.pfsense.org/).
39
 *
40
 * THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
41
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
44
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51
 * OF THE POSSIBILITY OF SUCH DAMAGE.
52
 */
53

    
54
##|+PRIV
55
##|*IDENT=page-services-pppoeserver
56
##|*NAME=Services: PPPoE Server
57
##|*DESCR=Allow access to the 'Services: PPPoE Server' page.
58
##|*MATCH=services_pppoe.php*
59
##|-PRIV
60

    
61
require_once("guiconfig.inc");
62
require_once("filter.inc");
63
require_once("vpn.inc");
64

    
65
if (!is_array($config['pppoes']['pppoe'])) {
66
	$config['pppoes']['pppoe'] = array();
67
}
68

    
69
$a_pppoes = &$config['pppoes']['pppoe'];
70

    
71
if ($_POST) {
72
	$pconfig = $_POST;
73

    
74
	if ($_POST['apply']) {
75
		if (file_exists("{$g['tmp_path']}/.vpn_pppoe.apply")) {
76
			$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.vpn_pppoe.apply"));
77
			foreach ($toapplylist as $pppoeid) {
78
				if (!is_numeric($pppoeid)) {
79
					continue;
80
				}
81
				if (is_array($config['pppoes']['pppoe'])) {
82
					foreach ($config['pppoes']['pppoe'] as $pppoe) {
83
						if ($pppoe['pppoeid'] == $pppoeid) {
84
							vpn_pppoe_configure($pppoe);
85
							break;
86
						}
87
					}
88
				}
89
			}
90
			@unlink("{$g['tmp_path']}/.vpn_pppoe.apply");
91
		}
92
		$retval = 0;
93
		$retval |= filter_configure();
94
		$savemsg = get_std_save_message($retval);
95
		clear_subsystem_dirty('vpnpppoe');
96
	}
97
}
98

    
99
if ($_GET['act'] == "del") {
100
	if ($a_pppoes[$_GET['id']]) {
101
		if ("{$g['varrun_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid'] . "-vpn.pid") {
102
			killbypid("{$g['varrun_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid'] . "-vpn.pid");
103
		}
104
		if (is_dir("{$g['varetc_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid'])) {
105
			mwexec("/bin/rm -r {$g['varetc_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid']);
106
		}
107
		unset($a_pppoes[$_GET['id']]);
108
		write_config();
109
		header("Location: services_pppoe.php");
110
		exit;
111
	}
112
}
113

    
114
$pgtitle = array(gettext("Services"), gettext("PPPoE Server"));
115
$shortcut_section = "pppoes";
116
include("head.inc");
117

    
118
if ($savemsg) {
119
	print_info_box($savemsg, 'success');
120
}
121

    
122
if (is_subsystem_dirty('vpnpppoe')) {
123
	print_apply_box(gettext('The PPPoE entry list has been changed.') . '<br />' . gettext('The changes must be applied for them to take effect.'));
124
}
125
?>
126

    
127
<div class="panel panel-default">
128
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('PPPoE Server')?></h2></div>
129
	<div class="panel-body">
130
	
131
	<div class="table-responsive">
132
	<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
133
		<thead>
134
			<tr>
135
				<th><?=gettext("Interface")?></th>
136
				<th><?=gettext("Local IP")?></th>
137
				<th><?=gettext("Number of users")?></th>
138
				<th><?=gettext("Description")?></th>
139
				<th><?=gettext("Actions")?></th>
140
			</tr>
141
		</thead>
142
		<tbody>
143
<?php
144
$i = 0;
145
foreach ($a_pppoes as $pppoe):
146
?>
147
			<tr>
148
				<td>
149
					<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($pppoe['interface']))?>
150
				</td>
151
				<td>
152
					<?=htmlspecialchars($pppoe['localip'])?>
153
				</td>
154
				<td>
155
					<?=htmlspecialchars($pppoe['n_pppoe_units'])?>
156
				</td>
157
				<td>
158
					<?=htmlspecialchars($pppoe['descr'])?>
159
				</td>
160
				<td>
161
					<a class="fa fa-pencil"	title="<?=gettext('Edit PPPoE instance')?>"	href="services_pppoe_edit.php?id=<?=$i?>"></a>
162
					<a class="fa fa-trash" title="<?=gettext('Delete PPPoE instance')?>" href="services_pppoe.php?act=del&amp;id=<?=$i?>"></a>
163
				</td>
164
			</tr>
165
<?php
166
	$i++;
167
endforeach;
168
?>
169
		</tbody>
170
	</table>
171
</div>
172

    
173
	</div>
174
</div>
175

    
176
<nav class="action-buttons">
177
	<a href="services_pppoe_edit.php" class="btn btn-success">
178
		<i class="fa fa-plus icon-embed-btn"></i>
179
		<?=gettext("Add")?>
180
	</a>
181
</nav>
182

    
183
<?php
184
include("foot.inc");
(136-136/227)