Project

General

Profile

Download (6.21 KB) Statistics
| Branch: | Tag: | Revision:
1 3818935a Scott Ullrich
<?php
2
/*
3 11d3a159 Phil Davis
	Copyright (C) 2010 Ermal Luci
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 11d3a159 Phil Davis
		if (is_dir("{$g['varetc_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid']))
79 61223023 Ermal
			mwexec("/bin/rm -r {$g['varetc_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid']);
80 0e642c78 Ermal
		unset($a_pppoes[$_GET['id']]);
81 3818935a Scott Ullrich
		write_config();
82 0e642c78 Ermal
		header("Location: vpn_pppoe.php");
83
		exit;
84 3818935a Scott Ullrich
	}
85
}
86
87 0e642c78 Ermal
$pgtitle = array(gettext("VPN"),gettext("PPPoE"));
88 b32dd0a6 jim-p
$shortcut_section = "pppoes";
89 3818935a Scott Ullrich
include("head.inc");
90
91
?>
92
93
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
94
<?php include("fbegin.inc"); ?>
95 0e642c78 Ermal
<form action="vpn_pppoe.php" method="post">
96 3818935a Scott Ullrich
<?php if ($savemsg) print_info_box($savemsg); ?>
97 ce6c33e3 Colin Fleming
<?php if (is_subsystem_dirty('vpnpppoe')): ?><br/>
98 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."));?>
99 0e642c78 Ermal
<?php endif; ?>
100
101
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
102
<tr>
103
  <td width="15%" class="listhdrr"><?=gettext("Interface");?></td>
104 2b656168 Chris Buechler
  <td width="10%" class="listhdrr"><?=gettext("Local IP");?></td>
105 0e642c78 Ermal
  <td width="25%" class="listhdrr"><?=gettext("Number of users");?></td>
106
  <td width="25%" class="listhdr"><?=gettext("Description");?></td>
107
  <td width="5%" class="list">
108 ce6c33e3 Colin Fleming
    <table border="0" cellspacing="0" cellpadding="1" summary="pppoe server">
109 0e642c78 Ermal
      <tr>
110
	<td valign="middle" width="17">&nbsp;</td>
111 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>
112 0e642c78 Ermal
      </tr>
113
    </table>
114
  </td>
115
</tr>
116
	  <?php $i = 0; foreach ($a_pppoes as $pppoe): ?>
117
<tr>
118
  <td class="listlr" ondblclick="document.location='vpn_pppoe_edit.php?id=<?=$i;?>';">
119
    <?=htmlspecialchars(strtoupper($pppoe['interface']));?>
120
  </td>
121
  <td class="listlr" ondblclick="document.location='vpn_pppoe_edit.php?id=<?=$i;?>';">
122
    <?=htmlspecialchars($pppoe['localip']);?>
123
  </td>
124
  <td class="listr" ondblclick="document.location='vpn_pppoe_edit.php?id=<?=$i;?>';">
125
      <?=htmlspecialchars($pppoe['n_pppoe_units']);?>
126
  </td>
127
  <td class="listbg" ondblclick="document.location='vpn_pppoe_edit.php?id=<?=$i;?>';">
128
    <?=htmlspecialchars($pppoe['descr']);?>&nbsp;
129
  </td>
130 ce6c33e3 Colin Fleming
  <td valign="middle" class="list nowrap">
131
    <table border="0" cellspacing="0" cellpadding="1" summary="icons">
132 0e642c78 Ermal
      <tr>
133 ce6c33e3 Colin Fleming
        <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>
134
        <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>
135 0e642c78 Ermal
      </tr>
136
    </table>
137
  </td>
138
</tr>
139
	  <?php $i++; endforeach; ?>
140
<tr>
141
  <td class="list" colspan="4"></td>
142
  <td class="list">
143 ce6c33e3 Colin Fleming
    <table border="0" cellspacing="0" cellpadding="1" summary="add">
144 0e642c78 Ermal
      <tr>
145
	<td valign="middle" width="17">&nbsp;</td>
146 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>
147 0e642c78 Ermal
      </tr>
148
    </table>
149
  </td>
150
</tr>
151 3818935a Scott Ullrich
</table>
152
</form>
153
<?php include("fend.inc"); ?>
154
</body>
155
</html>