Project

General

Profile

Download (4.34 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
	vpn_pppoe.php
4
	Copyright (C) 2010 Ermal Luci
5
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
6
	All rights reserved.
7

    
8
	Redistribution and use in source and binary forms, with or without
9
	modification, are permitted provided that the following conditions are met:
10

    
11
	1. Redistributions of source code must retain the above copyright notice,
12
	   this list of conditions and the following disclaimer.
13

    
14
	2. Redistributions in binary form must reproduce the above copyright
15
	   notice, this list of conditions and the following disclaimer in the
16
	   documentation and/or other materials provided with the distribution.
17

    
18
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
19
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
20
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
22
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
	POSSIBILITY OF SUCH DAMAGE.
28
*/
29
/*
30
	pfSense_MODULE: pppoe
31
*/
32

    
33
##|+PRIV
34
##|*IDENT=page-services-pppoeserver
35
##|*NAME=Services: PPPoE Server page
36
##|*DESCR=Allow access to the 'Services: PPPoE Server' page.
37
##|*MATCH=vpn_pppoe.php*
38
##|-PRIV
39

    
40
require_once("guiconfig.inc");
41
require_once("filter.inc");
42
require_once("vpn.inc");
43

    
44
if (!is_array($config['pppoes']['pppoe']))
45
	$config['pppoes']['pppoe'] = array();
46

    
47
$a_pppoes = &$config['pppoes']['pppoe'];
48

    
49
if ($_POST) {
50
	$pconfig = $_POST;
51

    
52
	if ($_POST['apply']) {
53
		if (file_exists("{$g['tmp_path']}/.vpn_pppoe.apply")) {
54
			$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.vpn_pppoe.apply"));
55
			foreach ($toapplylist as $pppoeid) {
56
				if (!is_numeric($pppoeid))
57
					continue;
58
				if (is_array($config['pppoes']['pppoe'])) {
59
					foreach ($config['pppoes']['pppoe'] as $pppoe) {
60
						if ($pppoe['pppoeid'] == $pppoeid) {
61
							vpn_pppoe_configure($pppoe);
62
							break;
63
						}
64
					}
65
				}
66
			}
67
			@unlink("{$g['tmp_path']}/.vpn_pppoe.apply");
68
		}
69
		$retval = 0;
70
		$retval |= filter_configure();
71
		$savemsg = get_std_save_message($retval);
72
		clear_subsystem_dirty('vpnpppoe');
73
	}
74
}
75

    
76
if ($_GET['act'] == "del") {
77
	if ($a_pppoes[$_GET['id']]) {
78
		if ("{$g['varrun_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid'] . "-vpn.pid")
79
			killbypid("{$g['varrun_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid'] . "-vpn.pid");
80

    
81
		if (is_dir("{$g['varetc_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid']))
82
			mwexec("/bin/rm -r {$g['varetc_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid']);
83

    
84
		unset($a_pppoes[$_GET['id']]);
85
		write_config();
86
		header("Location: vpn_pppoe.php");
87
		exit;
88
	}
89
}
90

    
91
$pgtitle = array(gettext("VPN"),gettext("PPPoE"));
92
$shortcut_section = "pppoes";
93
include("head.inc");
94

    
95
if ($savemsg)
96
	print_info_box($savemsg, 'success');
97

    
98
if (is_subsystem_dirty('vpnpppoe'))
99
	print_info_box_np(gettext('The PPPoE entry list has been changed') . '.<br />' . gettext('You must apply the changes in order for them to take effect.'));
100
?>
101

    
102
<div class="table-responsive">
103
	<table class="table table-striped table-hover table-condensed">
104
		<thead>
105
			<tr>
106
				<th><?=gettext("Interface")?></th>
107
				<th><?=gettext("Local IP")?></th>
108
				<th><?=gettext("Number of users")?></th>
109
				<th><?=gettext("Description")?></th>
110
				<th><!-- Action buttons --></th>
111
			</tr>
112
		</thead>
113
		<tbody>
114
<?php
115
$i = 0;
116
foreach ($a_pppoes as $pppoe):
117
?>
118
			<tr>
119
				<td>
120
					<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($pppoe['interface']))?>
121
				</td>
122
				<td>
123
					<?=htmlspecialchars($pppoe['localip'])?>
124
				</td>
125
				<td>
126
					<?=htmlspecialchars($pppoe['n_pppoe_units'])?>
127
				</td>
128
				<td>
129
					<?=htmlspecialchars($pppoe['descr'])?>
130
				</td>
131
				<td>
132
					<a href="vpn_pppoe_edit.php?id=<?=$i?>" class="btn btn-xs btn-info"><?=gettext('Edit')?></a>
133
					<a href="vpn_pppoe.php?act=del&amp;id=<?=$i?>" class="btn btn-xs btn-danger"><?=gettext('Delete')?></a>
134
				</td>
135
			</tr>
136
<?php
137
	$i++;
138
endforeach;
139
?>
140
		</tbody>
141
	</table>
142
</div>
143

    
144
<nav class="action-buttons">
145
	<a href="vpn_pppoe_edit.php" class="btn btn-success"><?=gettext("Add")?></a>
146
</nav>
147

    
148
<?php
149
include("foot.inc");
(231-231/237)