Project

General

Profile

Download (6.31 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
		if (is_dir("{$g['varetc_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid']))
81
			mwexec("/bin/rm -r {$g['varetc_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid']);
82
		unset($a_pppoes[$_GET['id']]);
83
		write_config();
84
		header("Location: vpn_pppoe.php");
85
		exit;
86
	}
87
}
88

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

    
93
?>
94

    
95
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
96
<?php include("fbegin.inc"); ?>
97
<form action="vpn_pppoe.php" method="post">
98
<?php if ($savemsg) print_info_box($savemsg); ?>
99
<?php if (is_subsystem_dirty('vpnpppoe')): ?><br/>
100
<?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
<?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
  <td width="10%" class="listhdrr"><?=gettext("Local IP");?></td>
107
  <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
    <table border="0" cellspacing="0" cellpadding="1" summary="pppoe server">
111
      <tr>
112
	<td valign="middle" width="17">&nbsp;</td>
113
        <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
      </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
    <?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($pppoe['interface']));?>
122
  </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
  <td valign="middle" class="list nowrap">
133
    <table border="0" cellspacing="0" cellpadding="1" summary="icons">
134
      <tr>
135
        <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
        <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
      </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
    <table border="0" cellspacing="0" cellpadding="1" summary="add">
146
      <tr>
147
	<td valign="middle" width="17">&nbsp;</td>
148
        <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
      </tr>
150
    </table>
151
  </td>
152
</tr>
153
</table>
154
</form>
155
<?php include("fend.inc"); ?>
156
</body>
157
</html>
(250-250/256)