Project

General

Profile

Download (6.24 KB) Statistics
| Branch: | Tag: | Revision:

univnautes / usr / local / www / vpn_pppoe.php @ a1b66bec

1
<?php
2
/*
3
	Copyright (C) 2010 Ermal Luci
4
	All rights reserved.
5

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

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

    
12
	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

    
16
	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
/*
28
	pfSense_MODULE:	pppoe
29
*/
30

    
31
##|+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
require_once("guiconfig.inc");
39
require_once("filter.inc");
40
require_once("vpn.inc");
41

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

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

    
47
if ($_POST) {
48
        $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

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

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

    
91
?>
92

    
93
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
94
<?php include("fbegin.inc"); ?>
95
<form action="vpn_pppoe.php" method="post">
96
<?php if ($savemsg) print_info_box($savemsg); ?>
97
<?php if (is_subsystem_dirty('vpnpppoe')): ?><br/>
98
<?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
<?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
  <td width="10%" class="listhdrr"><?=gettext("Local IP");?></td>
105
  <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
    <table border="0" cellspacing="0" cellpadding="1" summary="pppoe server">
109
      <tr>
110
	<td valign="middle" width="17">&nbsp;</td>
111
        <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
      </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(convert_friendly_interface_to_friendly_descr($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
  <td valign="middle" class="list nowrap">
131
    <table border="0" cellspacing="0" cellpadding="1" summary="icons">
132
      <tr>
133
        <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
      </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
    <table border="0" cellspacing="0" cellpadding="1" summary="add">
144
      <tr>
145
	<td valign="middle" width="17">&nbsp;</td>
146
        <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
      </tr>
148
    </table>
149
  </td>
150
</tr>
151
</table>
152
</form>
153
<?php include("fend.inc"); ?>
154
</body>
155
</html>
(250-250/256)