1
|
<?php
|
2
|
/*
|
3
|
vpn_l2tp_users.php
|
4
|
part of pfSense
|
5
|
|
6
|
Copyright (C) 2005 Scott Ullrich (sullrich@gmail.com)
|
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 the
|
17
|
documentation and/or other materials provided with the distribution.
|
18
|
|
19
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
20
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
21
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
22
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
23
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
24
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
25
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
26
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
27
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28
|
POSSIBILITY OF SUCH DAMAGE.
|
29
|
*/
|
30
|
|
31
|
##|+PRIV
|
32
|
##|*IDENT=page-vpn-vpnl2tp-users
|
33
|
##|*NAME=VPN: VPN L2TP : Users page
|
34
|
##|*DESCR=Allow access to the 'VPN: VPN L2TP : Users' page.
|
35
|
##|*MATCH=vpn_l2tp_users.php*
|
36
|
##|-PRIV
|
37
|
|
38
|
$pgtitle = array(gettext("VPN"),gettext("L2TP"),gettext("Users"));
|
39
|
$shortcut_section = "l2tps";
|
40
|
|
41
|
require("guiconfig.inc");
|
42
|
require_once("vpn.inc");
|
43
|
|
44
|
if (!is_array($config['l2tp']['user'])) {
|
45
|
$config['l2tp']['user'] = array();
|
46
|
}
|
47
|
$a_secret = &$config['l2tp']['user'];
|
48
|
|
49
|
if ($_POST) {
|
50
|
|
51
|
$pconfig = $_POST;
|
52
|
|
53
|
if ($_POST['apply']) {
|
54
|
$retval = 0;
|
55
|
if (!is_subsystem_dirty('rebootreq')) {
|
56
|
$retval = vpn_l2tp_configure();
|
57
|
}
|
58
|
$savemsg = get_std_save_message($retval);
|
59
|
if ($retval == 0) {
|
60
|
if (is_subsystem_dirty('l2tpusers'))
|
61
|
clear_subsystem_dirty('l2tpusers');
|
62
|
}
|
63
|
}
|
64
|
}
|
65
|
|
66
|
if ($_GET['act'] == "del") {
|
67
|
if ($a_secret[$_GET['id']]) {
|
68
|
unset($a_secret[$_GET['id']]);
|
69
|
write_config();
|
70
|
mark_subsystem_dirty('l2tpusers');
|
71
|
pfSenseHeader("vpn_l2tp_users.php");
|
72
|
exit;
|
73
|
}
|
74
|
}
|
75
|
|
76
|
include("head.inc");
|
77
|
?>
|
78
|
|
79
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
|
80
|
<?php include("fbegin.inc"); ?>
|
81
|
<div id="inputerrors"></div>
|
82
|
<form action="vpn_l2tp_users.php" method="post">
|
83
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
84
|
<?php if (isset($config['l2tp']['radius']['enable']))
|
85
|
print_info_box(gettext("Warning: RADIUS is enabled. The local user database will not be used.")); ?>
|
86
|
<?php if (is_subsystem_dirty('l2tpusers')): ?><br/>
|
87
|
<?php print_info_box_np(gettext("The l2tp user list has been modified") . ".<br />" . gettext("You must apply the changes in order for them to take effect") . ".<br /><b>" . gettext("Warning: this will terminate all current l2tp sessions!") . "</b>");?><br />
|
88
|
<?php endif; ?>
|
89
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="vpn l2pt users">
|
90
|
<tr><td class="tabnavtbl">
|
91
|
<?php
|
92
|
$tab_array = array();
|
93
|
$tab_array[0] = array(gettext("Configuration"), false, "vpn_l2tp.php");
|
94
|
$tab_array[1] = array(gettext("Users"), true, "vpn_l2tp_users.php");
|
95
|
display_top_tabs($tab_array);
|
96
|
?> </td></tr>
|
97
|
<tr>
|
98
|
<td>
|
99
|
<div id="mainarea">
|
100
|
<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
|
101
|
<tr>
|
102
|
<td class="listhdrr"><?=gettext("Username");?></td>
|
103
|
<td class="listhdr"><?=gettext("IP address");?></td>
|
104
|
<td class="list"></td>
|
105
|
</tr>
|
106
|
<?php $i = 0; foreach ($a_secret as $secretent): ?>
|
107
|
<tr>
|
108
|
<td class="listlr">
|
109
|
<?=htmlspecialchars($secretent['name']);?>
|
110
|
</td>
|
111
|
<td class="listr">
|
112
|
<?php if($secretent['ip'] == "") $secretent['ip'] = "Dynamic"; ?>
|
113
|
<?=htmlspecialchars($secretent['ip']);?>
|
114
|
</td>
|
115
|
<td class="list nowrap"><a href="vpn_l2tp_users_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="edit user" width="17" height="17" border="0" alt="edit" /></a>
|
116
|
<a href="vpn_l2tp_users.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this user?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="<?=gettext("delete user"); ?>" width="17" height="17" border="0" alt="delete" /></a></td>
|
117
|
</tr>
|
118
|
<?php $i++; endforeach; ?>
|
119
|
<tr>
|
120
|
<td class="list" colspan="2"></td>
|
121
|
<td class="list"> <a href="vpn_l2tp_users_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add user"); ?>" width="17" height="17" border="0" alt="add" /></a></td>
|
122
|
</tr>
|
123
|
</table>
|
124
|
</div>
|
125
|
</td>
|
126
|
</tr>
|
127
|
</table>
|
128
|
</form>
|
129
|
|
130
|
<?php include("fend.inc"); ?>
|
131
|
</body>
|
132
|
</html>
|