Project

General

Profile

Download (5.03 KB) Statistics
| Branch: | Tag: | Revision:
1 589f92bb gnhb
<?php
2
/* $Id$ */
3
/*
4 42809b4a gnhb
	interfaces_ppps.php
5 589f92bb gnhb
	part of m0n0wall (http://m0n0.ch/wall)
6
7
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
8
	All rights reserved.
9
10
	Redistribution and use in source and binary forms, with or without
11
	modification, are permitted provided that the following conditions are met:
12
13
	1. Redistributions of source code must retain the above copyright notice,
14
	   this list of conditions and the following disclaimer.
15
16
	2. Redistributions in binary form must reproduce the above copyright
17
	   notice, this list of conditions and the following disclaimer in the
18
	   documentation and/or other materials provided with the distribution.
19
20
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
24
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
	POSSIBILITY OF SUCH DAMAGE.
30
*/
31
/*
32
	pfSense_BUILDER_BINARIES:	/sbin/ifconfig
33
	pfSense_MODULE:	interfaces
34
*/
35
36
##|+PRIV
37 42809b4a gnhb
##|*IDENT=page-interfaces-ppps
38
##|*NAME=Interfaces: ppps page
39
##|*DESCR=Allow access to the 'Interfaces: ppps' page.
40
##|*MATCH=interfaces_ppps.php*
41 589f92bb gnhb
##|-PRIV
42
43
require("guiconfig.inc");
44
45 e51cea69 gnhb
if (!is_array($config['ppps']['ppp']))
46
	$config['ppps']['ppp'] = array();
47 589f92bb gnhb
48 e51cea69 gnhb
$a_ppps = &$config['ppps']['ppp'] ;
49 589f92bb gnhb
50 e51cea69 gnhb
function ppp_inuse($num) {
51 42809b4a gnhb
	global $config, $g, $a_ppps;
52
	$iflist = get_configured_interface_list(false, true);
53
	foreach ($iflist as $if) {
54
		if (isset($config['interfaces'][$if]['ptpid']) && $config['interfaces'][$if]['ptpid'] == $a_ppps[$num]['ptpid'])
55
			return true;
56
	}
57
	return false;
58 589f92bb gnhb
}
59
60
if ($_GET['act'] == "del") {
61
	/* check if still in use */
62 e51cea69 gnhb
	if (ppp_inuse($_GET['id'])) {
63 42809b4a gnhb
		$input_errors[] = "This point-to-point link cannot be deleted because it is still being used as an interface.";
64 589f92bb gnhb
	} else {
65 e51cea69 gnhb
		unset($a_ppps[$_GET['id']]);
66 589f92bb gnhb
		write_config();
67 42809b4a gnhb
		header("Location: interfaces_ppps.php");
68 589f92bb gnhb
		exit;
69
	}
70
}
71
72 42809b4a gnhb
$pgtitle = "Interfaces: PPPs";
73 589f92bb gnhb
include("head.inc");
74
75
?>
76
77
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
78
<?php include("fbegin.inc"); ?>
79
<?php if ($input_errors) print_input_errors($input_errors); ?>
80
<table width="100%" border="0" cellpadding="0" cellspacing="0">
81
  <tr><td>
82
<?php
83
	$tab_array = array();
84
	$tab_array[0] = array("Interface assignments", false, "interfaces_assign.php");
85
	$tab_array[1] = array("Interface Groups", false, "interfaces_groups.php");
86
	$tab_array[2] = array("Wireless", false, "interfaces_wireless.php");
87 d02951e9 gnhb
	$tab_array[3] = array("VLANs", false, "interfaces_vlan.php");
88 589f92bb gnhb
	$tab_array[4] = array("QinQs", false, "interfaces_qinq.php");
89 42809b4a gnhb
	$tab_array[5] = array("PPPs", false, "interfaces_ppps.php");
90
	$tab_array[6] = array("GRE", false, "interfaces_gre.php");
91
	$tab_array[7] = array("GIF", false, "interfaces_gif.php");
92
	$tab_array[8] = array("Bridges", false, "interfaces_bridge.php");
93
	$tab_array[9] = array("LAGG", false, "interfaces_lagg.php");
94 589f92bb gnhb
	display_top_tabs($tab_array);
95
?>
96
  </td></tr>
97
  <tr>
98
    <td>
99
	<div id="mainarea">
100
	<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
101
                <tr>
102 e51cea69 gnhb
                	<td width="20%" class="listhdrr">Type</td>
103
                  <td width="20%" class="listhdrr">Interface(s)/Port(s)</td>
104
                  <td width="40%" class="listhdr">Description</td>
105 589f92bb gnhb
                  <td width="10%" class="list"></td>
106
				</tr>
107 e51cea69 gnhb
			  <?php $i = 0; foreach ($a_ppps as $id => $ppp): ?>
108 42809b4a gnhb
                <tr  ondblclick="document.location='interfaces_ppps_edit.php?id=<?=$i;?>'">
109 e51cea69 gnhb
                	<td class="listr">
110 42809b4a gnhb
					<?=htmlspecialchars($ppp['type']);?>
111 589f92bb gnhb
                  </td>
112
                  <td class="listr">
113 e51cea69 gnhb
					<?=htmlspecialchars($ppp['ports']);?>
114 589f92bb gnhb
                  </td>
115
                  <td class="listbg">
116 e51cea69 gnhb
                    <?=htmlspecialchars($ppp['descr']);?>&nbsp;
117 589f92bb gnhb
                  </td>
118 42809b4a gnhb
                  <td valign="middle" nowrap class="list"> <a href="interfaces_ppps_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a>
119
                     &nbsp;<a href="interfaces_ppps.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this PPP interface?')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td>
120 589f92bb gnhb
				</tr>
121
			  <?php $i++; endforeach; ?>
122
                <tr>
123
                  <td class="list" colspan="3">&nbsp;</td>
124 42809b4a gnhb
                  <td class="list"> <a href="interfaces_ppps_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
125 589f92bb gnhb
				</tr>
126
              </table>
127
	      </div>
128
	</td>
129
	</tr>
130
</table>
131
<?php include("fend.inc"); ?>
132
</body>
133
</html>