Project

General

Profile

Download (5.74 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 cfb9eb9f Carlos Eduardo Ramos
require_once("functions.inc");
45 589f92bb gnhb
46 e51cea69 gnhb
function ppp_inuse($num) {
47 c5ce8398 jim-p
	global $config, $g;
48 42809b4a gnhb
	$iflist = get_configured_interface_list(false, true);
49 c5ce8398 jim-p
	if (!is_array($config['ppps']['ppp']))
50
		return false;
51
52 42809b4a gnhb
	foreach ($iflist as $if) {
53 c5ce8398 jim-p
		if ($config['interfaces'][$if]['if'] == $config['ppps']['ppp'][$num]['if'])
54 42809b4a gnhb
			return true;
55
	}
56
	return false;
57 589f92bb gnhb
}
58
59
if ($_GET['act'] == "del") {
60
	/* check if still in use */
61 e51cea69 gnhb
	if (ppp_inuse($_GET['id'])) {
62 f2047bd0 Rafael Lucas
		$input_errors[] = gettext("This point-to-point link cannot be deleted because it is still being used as an interface.");
63 c5ce8398 jim-p
	} elseif (is_array($config['ppps']['ppp']) && is_array($config['ppps']['ppp'][$_GET['id']])) {
64
65
		unset($config['ppps']['ppp'][$_GET['id']]['pppoe-reset-type']);
66
		handle_pppoe_reset($config['ppps']['ppp'][$_GET['id']]);
67
		unset($config['ppps']['ppp'][$_GET['id']]);
68 589f92bb gnhb
		write_config();
69 42809b4a gnhb
		header("Location: interfaces_ppps.php");
70 589f92bb gnhb
		exit;
71
	}
72
}
73
74 c5ce8398 jim-p
if (!is_array($config['ppps']['ppp']))
75
	$config['ppps']['ppp'] = array();
76
$a_ppps = $config['ppps']['ppp'];
77
78 f2047bd0 Rafael Lucas
$pgtitle = gettext("Interfaces: PPPs");
79 589f92bb gnhb
include("head.inc");
80
81
?>
82
83
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
84
<?php include("fbegin.inc"); ?>
85
<?php if ($input_errors) print_input_errors($input_errors); ?>
86
<table width="100%" border="0" cellpadding="0" cellspacing="0">
87
  <tr><td>
88
<?php
89
	$tab_array = array();
90 f2047bd0 Rafael Lucas
	$tab_array[0] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
91
	$tab_array[1] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
92
	$tab_array[2] = array(gettext("Wireless"), false, "interfaces_wireless.php");
93
	$tab_array[3] = array(gettext("VLANs"), false, "interfaces_vlan.php");
94
	$tab_array[4] = array(gettext("QinQs"), false, "interfaces_qinq.php");
95
	$tab_array[5] = array(gettext("PPPs"), true, "interfaces_ppps.php");
96
	$tab_array[6] = array(gettext("GRE"), false, "interfaces_gre.php");
97
	$tab_array[7] = array(gettext("GIF"), false, "interfaces_gif.php");
98
	$tab_array[8] = array(gettext("Bridges"), false, "interfaces_bridge.php");
99
	$tab_array[9] = array(gettext("LAGG"), false, "interfaces_lagg.php");
100 589f92bb gnhb
	display_top_tabs($tab_array);
101
?>
102
  </td></tr>
103
  <tr>
104
    <td>
105
	<div id="mainarea">
106
	<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
107
                <tr>
108 f2047bd0 Rafael Lucas
                	<td width="20%" class="listhdrr"><?=gettext("Interface");?></td>
109
                  <td width="20%" class="listhdrr"><?=gettext("Interface(s)/Port(s)");?></td>
110
                  <td width="40%" class="listhdr"><?=gettext("Description");?></td>
111 589f92bb gnhb
                  <td width="10%" class="list"></td>
112
				</tr>
113 e51cea69 gnhb
			  <?php $i = 0; foreach ($a_ppps as $id => $ppp): ?>
114 42809b4a gnhb
                <tr  ondblclick="document.location='interfaces_ppps_edit.php?id=<?=$i;?>'">
115 e51cea69 gnhb
                	<td class="listr">
116 e5d558bf gnhb
					<?=htmlspecialchars($ppp['if']);?>
117 589f92bb gnhb
                  </td>
118
                  <td class="listr">
119 64b4be44 Ermal
					<?php
120
						$portlist = explode(",", $ppp['ports']);
121
						foreach ($portlist as $portid => $port) {
122 69c1b043 gnhb
							if ($port != get_real_interface($port) && $ppp['type'] != "ppp")
123 64b4be44 Ermal
								$portlist[$portid] = convert_friendly_interface_to_friendly_descr($port);
124
						}
125
						echo htmlspecialchars(implode(",", $portlist));
126
					?>
127 589f92bb gnhb
                  </td>
128
                  <td class="listbg">
129 e51cea69 gnhb
                    <?=htmlspecialchars($ppp['descr']);?>&nbsp;
130 589f92bb gnhb
                  </td>
131 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>
132 6b1bac0a Vinicius Coque
                     &nbsp;<a href="interfaces_ppps.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("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>
133 589f92bb gnhb
				</tr>
134
			  <?php $i++; endforeach; ?>
135
                <tr>
136
                  <td class="list" colspan="3">&nbsp;</td>
137 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>
138 589f92bb gnhb
				</tr>
139
              </table>
140
	      </div>
141
	</td>
142
	</tr>
143
</table>
144
<?php include("fend.inc"); ?>
145
</body>
146
</html>