Project

General

Profile

Download (4.33 KB) Statistics
| Branch: | Tag: | Revision:
1 9f428275 Erik Fonnesbeck
<?php
2
/* $Id$ */
3
/*
4
	interfaces_wireless.php
5
6
	Copyright (C) 2010 Erik Fonnesbeck
7 ce77a9c4 Phil Davis
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
8 9f428275 Erik Fonnesbeck
	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 719e4eeb sbeaver
	pfSense_MODULE: interfaces_assign
33 9f428275 Erik Fonnesbeck
*/
34
35
##|+PRIV
36
##|*IDENT=page-interfaces-wireless
37
##|*NAME=Interfaces: Wireless page
38
##|*DESCR=Allow access to the 'Interfaces: Wireless' page.
39
##|*MATCH=interfaces_wireless.php*
40
##|-PRIV
41
42
require("guiconfig.inc");
43
44 2af86dda Phil Davis
if (!is_array($config['wireless'])) {
45 6ef2297b Erik Fonnesbeck
	$config['wireless'] = array();
46 2af86dda Phil Davis
}
47
if (!is_array($config['wireless']['clone'])) {
48 9f428275 Erik Fonnesbeck
	$config['wireless']['clone'] = array();
49 2af86dda Phil Davis
}
50 9f428275 Erik Fonnesbeck
51 16120707 Erik Fonnesbeck
$a_clones = &$config['wireless']['clone'];
52 9f428275 Erik Fonnesbeck
53 16120707 Erik Fonnesbeck
function clone_inuse($num) {
54
	global $config, $a_clones;
55 9f428275 Erik Fonnesbeck
56 38b7d47d Erik Fonnesbeck
	$iflist = get_configured_interface_list(false, true);
57 28f697ab sbeaver
58 9f428275 Erik Fonnesbeck
	foreach ($iflist as $if) {
59 2af86dda Phil Davis
		if ($config['interfaces'][$if]['if'] == $a_clones[$num]['cloneif']) {
60 9f428275 Erik Fonnesbeck
			return true;
61 2af86dda Phil Davis
		}
62 9f428275 Erik Fonnesbeck
	}
63
64
	return false;
65
}
66
67
if ($_GET['act'] == "del") {
68
	/* check if still in use */
69 16120707 Erik Fonnesbeck
	if (clone_inuse($_GET['id'])) {
70 55344749 Rafael Lucas
		$input_errors[] = gettext("This wireless clone cannot be deleted because it is assigned as an interface.");
71 9f428275 Erik Fonnesbeck
	} else {
72
		mwexec("/sbin/ifconfig " . $a_clones[$_GET['id']]['cloneif'] . " destroy");
73
		unset($a_clones[$_GET['id']]);
74
75
		write_config();
76
77
		header("Location: interfaces_wireless.php");
78
		exit;
79
	}
80
}
81
82
83 6c07db48 Phil Davis
$pgtitle = array(gettext("Interfaces"), gettext("Wireless"));
84 b32dd0a6 jim-p
$shortcut_section = "wireless";
85 9f428275 Erik Fonnesbeck
include("head.inc");
86
87 719e4eeb sbeaver
if ($input_errors)
88
	print_input_errors($input_errors); ?>
89
90
<?php
91
$tab_array = array();
92 28f697ab sbeaver
$tab_array[] = array(gettext("Interface assignments"), false, "interfaces_assign.php");
93
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
94
$tab_array[] = array(gettext("Wireless"), true, "interfaces_wireless.php");
95
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
96
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
97
$tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php");
98
$tab_array[] = array(gettext("GRE"), false, "interfaces_gre.php");
99
$tab_array[] = array(gettext("GIF"), false, "interfaces_gif.php");
100
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
101
$tab_array[] = array(gettext("LAGG"), false, "interfaces_lagg.php");
102 719e4eeb sbeaver
display_top_tabs($tab_array);
103 9f428275 Erik Fonnesbeck
?>
104
105 719e4eeb sbeaver
<div class="table-responsive">
106
	<table class="table table-striped table-hover table-condensed">
107
		<thead>
108
			<tr>
109
			  <th><?=gettext("Interface"); ?></th>
110
			  <th><?=gettext("Mode"); ?></th>
111
			  <th><?=gettext("Description"); ?></th>
112
			  <th></th>
113
			</tr>
114
		</thead>
115
		<tbody>
116 9f428275 Erik Fonnesbeck
<?php
117 719e4eeb sbeaver
118
$i = 0;
119
120
foreach ($a_clones as $clone) {
121 9f428275 Erik Fonnesbeck
?>
122 4cde9954 Sjon Hortensius
			<tr>
123 719e4eeb sbeaver
				<td>
124
					<?=htmlspecialchars($clone['cloneif'])?>
125
				</td>
126
				<td>
127 651fff4f Erik Fonnesbeck
					<?= $wlan_modes[$clone['mode']]; ?>
128 719e4eeb sbeaver
				</td>
129
				<td>
130
					<?=htmlspecialchars($clone['descr'])?>
131
				</td>
132
				<td>
133
					<a href="interfaces_wireless_edit.php?id=<?=$i?>" class="btn btn-default btn-xs"><?=gettext("Edit")?></a>
134
					<a href="interfaces_wireless.php?act=del&amp;id=<?=$i?>" class="btn btn-danger btn-xs"><?=gettext("Delete")?></a>
135
				</td>
136 8cd56132 Colin Fleming
			</tr>
137 719e4eeb sbeaver
<?php
138
	$i++;
139
}
140
?>
141
		</tbody>
142
	</table>
143 28f697ab sbeaver
144
	<nav class="action-buttons">
145
		<a href="interfaces_wireless_edit.php" class="btn btn-success"><?=gettext("Add")?></a>
146
	</nav>
147 719e4eeb sbeaver
</div>
148
<?php
149
include("foot.inc");