Project

General

Profile

Download (6.31 KB) Statistics
| Branch: | Tag: | Revision:
1 3818935a Scott Ullrich
<?php
2
/*
3 ce77a9c4 Phil Davis
	vpn_pppoe.php
4 11d3a159 Phil Davis
	Copyright (C) 2010 Ermal Luci
5 ce77a9c4 Phil Davis
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
6 3818935a Scott Ullrich
	All rights reserved.
7 0e642c78 Ermal
8 3818935a Scott Ullrich
	Redistribution and use in source and binary forms, with or without
9
	modification, are permitted provided that the following conditions are met:
10 0e642c78 Ermal
11 3818935a Scott Ullrich
	1. Redistributions of source code must retain the above copyright notice,
12
	   this list of conditions and the following disclaimer.
13 0e642c78 Ermal
14 3818935a Scott Ullrich
	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 0e642c78 Ermal
18 3818935a Scott Ullrich
	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 0e642c78 Ermal
/*
30
	pfSense_MODULE:	pppoe
31
*/
32 3818935a Scott Ullrich
33 6b07c15a Matthew Grooms
##|+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 0e642c78 Ermal
require_once("guiconfig.inc");
41
require_once("filter.inc");
42 483e6de8 Scott Ullrich
require_once("vpn.inc");
43 3818935a Scott Ullrich
44 0e642c78 Ermal
if (!is_array($config['pppoes']['pppoe']))
45
	$config['pppoes']['pppoe'] = array();
46 c8c416db Scott Ullrich
47 0e642c78 Ermal
$a_pppoes = &$config['pppoes']['pppoe'];
48 3818935a Scott Ullrich
49
if ($_POST) {
50 0e642c78 Ermal
        $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 3818935a Scott Ullrich
76 0e642c78 Ermal
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 11d3a159 Phil Davis
		if (is_dir("{$g['varetc_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid']))
81 61223023 Ermal
			mwexec("/bin/rm -r {$g['varetc_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid']);
82 0e642c78 Ermal
		unset($a_pppoes[$_GET['id']]);
83 3818935a Scott Ullrich
		write_config();
84 0e642c78 Ermal
		header("Location: vpn_pppoe.php");
85
		exit;
86 3818935a Scott Ullrich
	}
87
}
88
89 0e642c78 Ermal
$pgtitle = array(gettext("VPN"),gettext("PPPoE"));
90 b32dd0a6 jim-p
$shortcut_section = "pppoes";
91 3818935a Scott Ullrich
include("head.inc");
92
93
?>
94
95
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
96
<?php include("fbegin.inc"); ?>
97 0e642c78 Ermal
<form action="vpn_pppoe.php" method="post">
98 3818935a Scott Ullrich
<?php if ($savemsg) print_info_box($savemsg); ?>
99 ce6c33e3 Colin Fleming
<?php if (is_subsystem_dirty('vpnpppoe')): ?><br/>
100 8cd558b6 ayvis
<?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."));?>
101 0e642c78 Ermal
<?php endif; ?>
102
103
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
104
<tr>
105
  <td width="15%" class="listhdrr"><?=gettext("Interface");?></td>
106 2b656168 Chris Buechler
  <td width="10%" class="listhdrr"><?=gettext("Local IP");?></td>
107 0e642c78 Ermal
  <td width="25%" class="listhdrr"><?=gettext("Number of users");?></td>
108
  <td width="25%" class="listhdr"><?=gettext("Description");?></td>
109
  <td width="5%" class="list">
110 ce6c33e3 Colin Fleming
    <table border="0" cellspacing="0" cellpadding="1" summary="pppoe server">
111 0e642c78 Ermal
      <tr>
112
	<td valign="middle" width="17">&nbsp;</td>
113 ce6c33e3 Colin Fleming
        <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");?>" alt="add" /></a></td>
114 0e642c78 Ermal
      </tr>
115
    </table>
116
  </td>
117
</tr>
118
	  <?php $i = 0; foreach ($a_pppoes as $pppoe): ?>
119
<tr>
120
  <td class="listlr" ondblclick="document.location='vpn_pppoe_edit.php?id=<?=$i;?>';">
121 6859f881 Chris Buechler
    <?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($pppoe['interface']));?>
122 0e642c78 Ermal
  </td>
123
  <td class="listlr" ondblclick="document.location='vpn_pppoe_edit.php?id=<?=$i;?>';">
124
    <?=htmlspecialchars($pppoe['localip']);?>
125
  </td>
126
  <td class="listr" ondblclick="document.location='vpn_pppoe_edit.php?id=<?=$i;?>';">
127
      <?=htmlspecialchars($pppoe['n_pppoe_units']);?>
128
  </td>
129
  <td class="listbg" ondblclick="document.location='vpn_pppoe_edit.php?id=<?=$i;?>';">
130
    <?=htmlspecialchars($pppoe['descr']);?>&nbsp;
131
  </td>
132 ce6c33e3 Colin Fleming
  <td valign="middle" class="list nowrap">
133
    <table border="0" cellspacing="0" cellpadding="1" summary="icons">
134 0e642c78 Ermal
      <tr>
135 a8380480 Chris Buechler
        <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"); ?>" alt="edit" /></a></td>
136 ce6c33e3 Colin Fleming
        <td><a href="vpn_pppoe.php?act=del&amp;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");?>" alt="delete" /></a></td>
137 0e642c78 Ermal
      </tr>
138
    </table>
139
  </td>
140
</tr>
141
	  <?php $i++; endforeach; ?>
142
<tr>
143
  <td class="list" colspan="4"></td>
144
  <td class="list">
145 ce6c33e3 Colin Fleming
    <table border="0" cellspacing="0" cellpadding="1" summary="add">
146 0e642c78 Ermal
      <tr>
147
	<td valign="middle" width="17">&nbsp;</td>
148 ce6c33e3 Colin Fleming
        <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");?>" alt="add" /></a></td>
149 0e642c78 Ermal
      </tr>
150
    </table>
151
  </td>
152
</tr>
153 3818935a Scott Ullrich
</table>
154
</form>
155
<?php include("fend.inc"); ?>
156
</body>
157
</html>