1 |
3818935a
|
Scott Ullrich
|
<?php
|
2 |
|
|
/*
|
3 |
0e642c78
|
Ermal
|
Copyright (C) 2010 Ermal Lu?i
|
4 |
3818935a
|
Scott Ullrich
|
All rights reserved.
|
5 |
0e642c78
|
Ermal
|
|
6 |
3818935a
|
Scott Ullrich
|
Redistribution and use in source and binary forms, with or without
|
7 |
|
|
modification, are permitted provided that the following conditions are met:
|
8 |
0e642c78
|
Ermal
|
|
9 |
3818935a
|
Scott Ullrich
|
1. Redistributions of source code must retain the above copyright notice,
|
10 |
|
|
this list of conditions and the following disclaimer.
|
11 |
0e642c78
|
Ermal
|
|
12 |
3818935a
|
Scott Ullrich
|
2. Redistributions in binary form must reproduce the above copyright
|
13 |
|
|
notice, this list of conditions and the following disclaimer in the
|
14 |
|
|
documentation and/or other materials provided with the distribution.
|
15 |
0e642c78
|
Ermal
|
|
16 |
3818935a
|
Scott Ullrich
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
17 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
18 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
19 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
20 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
21 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
22 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
23 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
24 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
25 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
26 |
|
|
*/
|
27 |
0e642c78
|
Ermal
|
/*
|
28 |
|
|
pfSense_MODULE: pppoe
|
29 |
|
|
*/
|
30 |
3818935a
|
Scott Ullrich
|
|
31 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
32 |
|
|
##|*IDENT=page-services-pppoeserver
|
33 |
|
|
##|*NAME=Services: PPPoE Server page
|
34 |
|
|
##|*DESCR=Allow access to the 'Services: PPPoE Server' page.
|
35 |
|
|
##|*MATCH=vpn_pppoe.php*
|
36 |
|
|
##|-PRIV
|
37 |
|
|
|
38 |
0e642c78
|
Ermal
|
require_once("guiconfig.inc");
|
39 |
|
|
require_once("filter.inc");
|
40 |
483e6de8
|
Scott Ullrich
|
require_once("vpn.inc");
|
41 |
3818935a
|
Scott Ullrich
|
|
42 |
0e642c78
|
Ermal
|
if (!is_array($config['pppoes']['pppoe']))
|
43 |
|
|
$config['pppoes']['pppoe'] = array();
|
44 |
c8c416db
|
Scott Ullrich
|
|
45 |
0e642c78
|
Ermal
|
$a_pppoes = &$config['pppoes']['pppoe'];
|
46 |
3818935a
|
Scott Ullrich
|
|
47 |
|
|
if ($_POST) {
|
48 |
0e642c78
|
Ermal
|
$pconfig = $_POST;
|
49 |
|
|
|
50 |
|
|
if ($_POST['apply']) {
|
51 |
|
|
if (file_exists("{$g['tmp_path']}/.vpn_pppoe.apply")) {
|
52 |
|
|
$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.vpn_pppoe.apply"));
|
53 |
|
|
foreach ($toapplylist as $pppoeid) {
|
54 |
|
|
if (!is_numeric($pppoeid))
|
55 |
|
|
continue;
|
56 |
|
|
if (is_array($config['pppoes']['pppoe'])) {
|
57 |
|
|
foreach ($config['pppoes']['pppoe'] as $pppoe) {
|
58 |
|
|
if ($pppoe['pppoeid'] == $pppoeid) {
|
59 |
|
|
vpn_pppoe_configure($pppoe);
|
60 |
|
|
break;
|
61 |
|
|
}
|
62 |
|
|
}
|
63 |
|
|
}
|
64 |
|
|
}
|
65 |
|
|
@unlink("{$g['tmp_path']}/.vpn_pppoe.apply");
|
66 |
|
|
}
|
67 |
|
|
$retval = 0;
|
68 |
|
|
$retval |= filter_configure();
|
69 |
|
|
$savemsg = get_std_save_message($retval);
|
70 |
|
|
clear_subsystem_dirty('vpnpppoe');
|
71 |
|
|
}
|
72 |
|
|
}
|
73 |
3818935a
|
Scott Ullrich
|
|
74 |
0e642c78
|
Ermal
|
if ($_GET['act'] == "del") {
|
75 |
|
|
if ($a_pppoes[$_GET['id']]) {
|
76 |
|
|
if ("{$g['varrun_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid'] . "-vpn.pid")
|
77 |
|
|
killbypid("{$g['varrun_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid'] . "-vpn.pid");
|
78 |
|
|
mwexec("/bin/rm -r {$g['varetc_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid']);
|
79 |
|
|
unset($a_pppoes[$_GET['id']]);
|
80 |
3818935a
|
Scott Ullrich
|
write_config();
|
81 |
0e642c78
|
Ermal
|
header("Location: vpn_pppoe.php");
|
82 |
|
|
exit;
|
83 |
3818935a
|
Scott Ullrich
|
}
|
84 |
|
|
}
|
85 |
|
|
|
86 |
0e642c78
|
Ermal
|
$pgtitle = array(gettext("VPN"),gettext("PPPoE"));
|
87 |
3818935a
|
Scott Ullrich
|
include("head.inc");
|
88 |
|
|
|
89 |
|
|
?>
|
90 |
|
|
|
91 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
92 |
|
|
<?php include("fbegin.inc"); ?>
|
93 |
0e642c78
|
Ermal
|
<form action="vpn_pppoe.php" method="post">
|
94 |
3818935a
|
Scott Ullrich
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
95 |
0e642c78
|
Ermal
|
<?php if (is_subsystem_dirty('vpnpppoe')): ?><p>
|
96 |
|
|
<?php 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."));?>
|
97 |
|
|
<?php endif; ?>
|
98 |
|
|
|
99 |
|
|
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
|
100 |
|
|
<tr>
|
101 |
|
|
<td width="15%" class="listhdrr"><?=gettext("Interface");?></td>
|
102 |
2b656168
|
Chris Buechler
|
<td width="10%" class="listhdrr"><?=gettext("Local IP");?></td>
|
103 |
0e642c78
|
Ermal
|
<td width="25%" class="listhdrr"><?=gettext("Number of users");?></td>
|
104 |
|
|
<td width="25%" class="listhdr"><?=gettext("Description");?></td>
|
105 |
|
|
<td width="5%" class="list">
|
106 |
|
|
<table border="0" cellspacing="0" cellpadding="1">
|
107 |
|
|
<tr>
|
108 |
|
|
<td valign="middle" width="17"> </td>
|
109 |
|
|
<td valign="middle"><a href="vpn_pppoe_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add a new pppoe instance");?>"></a></td>
|
110 |
|
|
</tr>
|
111 |
|
|
</table>
|
112 |
|
|
</td>
|
113 |
|
|
</tr>
|
114 |
|
|
<?php $i = 0; foreach ($a_pppoes as $pppoe): ?>
|
115 |
|
|
<tr>
|
116 |
|
|
<td class="listlr" ondblclick="document.location='vpn_pppoe_edit.php?id=<?=$i;?>';">
|
117 |
|
|
<?=htmlspecialchars(strtoupper($pppoe['interface']));?>
|
118 |
|
|
</td>
|
119 |
|
|
<td class="listlr" ondblclick="document.location='vpn_pppoe_edit.php?id=<?=$i;?>';">
|
120 |
|
|
<?=htmlspecialchars($pppoe['localip']);?>
|
121 |
|
|
</td>
|
122 |
|
|
<td class="listr" ondblclick="document.location='vpn_pppoe_edit.php?id=<?=$i;?>';">
|
123 |
|
|
<?=htmlspecialchars($pppoe['n_pppoe_units']);?>
|
124 |
|
|
</td>
|
125 |
|
|
<td class="listbg" ondblclick="document.location='vpn_pppoe_edit.php?id=<?=$i;?>';">
|
126 |
|
|
<?=htmlspecialchars($pppoe['descr']);?>
|
127 |
|
|
</td>
|
128 |
|
|
<td valign="middle" nowrap class="list">
|
129 |
|
|
<table border="0" cellspacing="0" cellpadding="1">
|
130 |
|
|
<tr>
|
131 |
|
|
<td valign="middle"><a href="vpn_pppoe_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" title="<?=gettext("edit pppoe instance"); ?>"></a></td>
|
132 |
|
|
<td><a href="vpn_pppoe.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this entry? All elements that still use it will become invalid (e.g. filter rules)!");?>')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="<?=gettext("delete pppoe instance");?>"></a></td>
|
133 |
|
|
</tr>
|
134 |
|
|
</table>
|
135 |
|
|
</td>
|
136 |
|
|
</tr>
|
137 |
|
|
<?php $i++; endforeach; ?>
|
138 |
|
|
<tr>
|
139 |
|
|
<td class="list" colspan="4"></td>
|
140 |
|
|
<td class="list">
|
141 |
|
|
<table border="0" cellspacing="0" cellpadding="1">
|
142 |
|
|
<tr>
|
143 |
|
|
<td valign="middle" width="17"> </td>
|
144 |
|
|
<td valign="middle"><a href="vpn_pppoe_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?=gettext("add a new pppoe instance");?>"></a></td>
|
145 |
|
|
</td>
|
146 |
|
|
</tr>
|
147 |
|
|
</table>
|
148 |
|
|
</td>
|
149 |
|
|
</tr>
|
150 |
3818935a
|
Scott Ullrich
|
</table>
|
151 |
|
|
</form>
|
152 |
|
|
<?php include("fend.inc"); ?>
|
153 |
|
|
</body>
|
154 |
|
|
</html>
|