Project

General

Profile

Download (6.3 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
	Copyright (C) 2010 Ermal Luci
4
        Copyright (C) 2013-2015 Electric Sheep Fencing, LP
5
	All rights reserved.
6

    
7
	Redistribution and use in source and binary forms, with or without
8
	modification, are permitted provided that the following conditions are met:
9

    
10
	1. Redistributions of source code must retain the above copyright notice,
11
	   this list of conditions and the following disclaimer.
12

    
13
	2. Redistributions in binary form must reproduce the above copyright
14
	   notice, this list of conditions and the following disclaimer in the
15
	   documentation and/or other materials provided with the distribution.
16

    
17
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
19
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
20
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
21
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
	POSSIBILITY OF SUCH DAMAGE.
27
*/
28
/*
29
	pfSense_MODULE:	pppoe
30
*/
31

    
32
##|+PRIV
33
##|*IDENT=page-services-pppoeserver
34
##|*NAME=Services: PPPoE Server page
35
##|*DESCR=Allow access to the 'Services: PPPoE Server' page.
36
##|*MATCH=vpn_pppoe.php*
37
##|-PRIV
38

    
39
require_once("guiconfig.inc");
40
require_once("filter.inc");
41
require_once("vpn.inc");
42

    
43
if (!is_array($config['pppoes']['pppoe']))
44
	$config['pppoes']['pppoe'] = array();
45

    
46
$a_pppoes = &$config['pppoes']['pppoe'];
47

    
48
if ($_POST) {
49
        $pconfig = $_POST;
50

    
51
        if ($_POST['apply']) {
52
                if (file_exists("{$g['tmp_path']}/.vpn_pppoe.apply")) {
53
                        $toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.vpn_pppoe.apply"));
54
                        foreach ($toapplylist as $pppoeid) {
55
				if (!is_numeric($pppoeid))
56
					continue;
57
				if (is_array($config['pppoes']['pppoe'])) {
58
					foreach ($config['pppoes']['pppoe'] as $pppoe) {
59
						if ($pppoe['pppoeid'] == $pppoeid) {
60
							vpn_pppoe_configure($pppoe);
61
							break;
62
						}
63
					}
64
				}
65
                        }
66
                        @unlink("{$g['tmp_path']}/.vpn_pppoe.apply");
67
                }
68
                $retval = 0;
69
                $retval |= filter_configure();
70
                $savemsg = get_std_save_message($retval);
71
                clear_subsystem_dirty('vpnpppoe');
72
        }
73
}
74

    
75
if ($_GET['act'] == "del") {
76
	if ($a_pppoes[$_GET['id']]) {
77
		if ("{$g['varrun_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid'] . "-vpn.pid")
78
			killbypid("{$g['varrun_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid'] . "-vpn.pid");
79
		if (is_dir("{$g['varetc_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid']))
80
			mwexec("/bin/rm -r {$g['varetc_path']}/pppoe" . $a_pppoes[$_GET['id']]['pppoeid']);
81
		unset($a_pppoes[$_GET['id']]);
82
		write_config();
83
		header("Location: vpn_pppoe.php");
84
		exit;
85
	}
86
}
87

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

    
92
?>
93

    
94
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
95
<?php include("fbegin.inc"); ?>
96
<form action="vpn_pppoe.php" method="post">
97
<?php if ($savemsg) print_info_box($savemsg); ?>
98
<?php if (is_subsystem_dirty('vpnpppoe')): ?><br/>
99
<?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."));?>
100
<?php endif; ?>
101

    
102
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
103
<tr>
104
  <td width="15%" class="listhdrr"><?=gettext("Interface");?></td>
105
  <td width="10%" class="listhdrr"><?=gettext("Local IP");?></td>
106
  <td width="25%" class="listhdrr"><?=gettext("Number of users");?></td>
107
  <td width="25%" class="listhdr"><?=gettext("Description");?></td>
108
  <td width="5%" class="list">
109
    <table border="0" cellspacing="0" cellpadding="1" summary="pppoe server">
110
      <tr>
111
	<td valign="middle" width="17">&nbsp;</td>
112
        <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>
113
      </tr>
114
    </table>
115
  </td>
116
</tr>
117
	  <?php $i = 0; foreach ($a_pppoes as $pppoe): ?>
118
<tr>
119
  <td class="listlr" ondblclick="document.location='vpn_pppoe_edit.php?id=<?=$i;?>';">
120
    <?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($pppoe['interface']));?>
121
  </td>
122
  <td class="listlr" ondblclick="document.location='vpn_pppoe_edit.php?id=<?=$i;?>';">
123
    <?=htmlspecialchars($pppoe['localip']);?>
124
  </td>
125
  <td class="listr" ondblclick="document.location='vpn_pppoe_edit.php?id=<?=$i;?>';">
126
      <?=htmlspecialchars($pppoe['n_pppoe_units']);?>
127
  </td>
128
  <td class="listbg" ondblclick="document.location='vpn_pppoe_edit.php?id=<?=$i;?>';">
129
    <?=htmlspecialchars($pppoe['descr']);?>&nbsp;
130
  </td>
131
  <td valign="middle" class="list nowrap">
132
    <table border="0" cellspacing="0" cellpadding="1" summary="icons">
133
      <tr>
134
        <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>
135
        <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>
136
      </tr>
137
    </table>
138
  </td>
139
</tr>
140
	  <?php $i++; endforeach; ?>
141
<tr>
142
  <td class="list" colspan="4"></td>
143
  <td class="list">
144
    <table border="0" cellspacing="0" cellpadding="1" summary="add">
145
      <tr>
146
	<td valign="middle" width="17">&nbsp;</td>
147
        <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>
148
      </tr>
149
    </table>
150
  </td>
151
</tr>
152
</table>
153
</form>
154
<?php include("fend.inc"); ?>
155
</body>
156
</html>
(250-250/256)