Project

General

Profile

Download (4.04 KB) Statistics
| Branch: | Tag: | Revision:
1 9f428275 Erik Fonnesbeck
<?php
2
/*
3 c5d81585 Renato Botelho
 * interfaces_wireless.php
4 b9043cdc Stephen Beaver
 *
5 c5d81585 Renato Botelho
 * part of pfSense (https://www.pfsense.org)
6 81299b5c Renato Botelho
 * Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
7 c5d81585 Renato Botelho
 * Copyright (c) 2010 Erik Fonnesbeck
8
 * All rights reserved.
9 b9043cdc Stephen Beaver
 *
10 b12ea3fb Renato Botelho
 * Licensed under the Apache License, Version 2.0 (the "License");
11
 * you may not use this file except in compliance with the License.
12
 * You may obtain a copy of the License at
13 b9043cdc Stephen Beaver
 *
14 b12ea3fb Renato Botelho
 * http://www.apache.org/licenses/LICENSE-2.0
15 b9043cdc Stephen Beaver
 *
16 b12ea3fb Renato Botelho
 * Unless required by applicable law or agreed to in writing, software
17
 * distributed under the License is distributed on an "AS IS" BASIS,
18
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
 * See the License for the specific language governing permissions and
20
 * limitations under the License.
21 b9043cdc Stephen Beaver
 */
22 9f428275 Erik Fonnesbeck
23
##|+PRIV
24
##|*IDENT=page-interfaces-wireless
25 5230f468 jim-p
##|*NAME=Interfaces: Wireless
26 9f428275 Erik Fonnesbeck
##|*DESCR=Allow access to the 'Interfaces: Wireless' page.
27
##|*MATCH=interfaces_wireless.php*
28
##|-PRIV
29
30 c81ef6e2 Phil Davis
require_once("guiconfig.inc");
31 9f428275 Erik Fonnesbeck
32 2af86dda Phil Davis
if (!is_array($config['wireless'])) {
33 6ef2297b Erik Fonnesbeck
	$config['wireless'] = array();
34 2af86dda Phil Davis
}
35
if (!is_array($config['wireless']['clone'])) {
36 9f428275 Erik Fonnesbeck
	$config['wireless']['clone'] = array();
37 2af86dda Phil Davis
}
38 9f428275 Erik Fonnesbeck
39 16120707 Erik Fonnesbeck
$a_clones = &$config['wireless']['clone'];
40 9f428275 Erik Fonnesbeck
41 16120707 Erik Fonnesbeck
function clone_inuse($num) {
42
	global $config, $a_clones;
43 9f428275 Erik Fonnesbeck
44 38b7d47d Erik Fonnesbeck
	$iflist = get_configured_interface_list(false, true);
45 28f697ab sbeaver
46 9f428275 Erik Fonnesbeck
	foreach ($iflist as $if) {
47 2af86dda Phil Davis
		if ($config['interfaces'][$if]['if'] == $a_clones[$num]['cloneif']) {
48 9f428275 Erik Fonnesbeck
			return true;
49 2af86dda Phil Davis
		}
50 9f428275 Erik Fonnesbeck
	}
51
52
	return false;
53
}
54
55
if ($_GET['act'] == "del") {
56
	/* check if still in use */
57 16120707 Erik Fonnesbeck
	if (clone_inuse($_GET['id'])) {
58 55344749 Rafael Lucas
		$input_errors[] = gettext("This wireless clone cannot be deleted because it is assigned as an interface.");
59 9f428275 Erik Fonnesbeck
	} else {
60 414aa359 Renato Botelho
		pfSense_interface_destroy($a_clones[$_GET['id']]['cloneif']);
61 9f428275 Erik Fonnesbeck
		unset($a_clones[$_GET['id']]);
62
63
		write_config();
64
65
		header("Location: interfaces_wireless.php");
66
		exit;
67
	}
68
}
69
70
71 6c07db48 Phil Davis
$pgtitle = array(gettext("Interfaces"), gettext("Wireless"));
72 b32dd0a6 jim-p
$shortcut_section = "wireless";
73 9f428275 Erik Fonnesbeck
include("head.inc");
74
75 aa82505e Phil Davis
if ($input_errors) {
76 087bfe61 NOYB
	print_input_errors($input_errors);
77 aa82505e Phil Davis
}
78 719e4eeb sbeaver
79
$tab_array = array();
80 26b4bef8 k-paulius
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
81 28f697ab sbeaver
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
82
$tab_array[] = array(gettext("Wireless"), true, "interfaces_wireless.php");
83
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
84
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
85
$tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php");
86 26b4bef8 k-paulius
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
87
$tab_array[] = array(gettext("GIFs"), false, "interfaces_gif.php");
88 28f697ab sbeaver
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
89 26b4bef8 k-paulius
$tab_array[] = array(gettext("LAGGs"), false, "interfaces_lagg.php");
90 719e4eeb sbeaver
display_top_tabs($tab_array);
91 9f428275 Erik Fonnesbeck
?>
92 060ed238 Stephen Beaver
<div class="panel panel-default">
93 70dc5cd6 Phil Davis
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('Wireless Interfaces')?></h2></div>
94 060ed238 Stephen Beaver
	<div class="panel-body">
95
		<div class="table-responsive">
96 1c10ce97 PiBa-NL
			<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
97 060ed238 Stephen Beaver
				<thead>
98
					<tr>
99 70dc5cd6 Phil Davis
						<th><?=gettext("Interface"); ?></th>
100
						<th><?=gettext("Mode"); ?></th>
101
						<th><?=gettext("Description"); ?></th>
102
						<th><?=gettext("Actions"); ?></th>
103 060ed238 Stephen Beaver
					</tr>
104
				</thead>
105
				<tbody>
106 9f428275 Erik Fonnesbeck
<?php
107 719e4eeb sbeaver
108
$i = 0;
109
110
foreach ($a_clones as $clone) {
111 9f428275 Erik Fonnesbeck
?>
112 060ed238 Stephen Beaver
					<tr>
113
						<td>
114
							<?=htmlspecialchars($clone['cloneif'])?>
115
						</td>
116
						<td>
117
							<?= $wlan_modes[$clone['mode']]; ?>
118
						</td>
119
						<td>
120
							<?=htmlspecialchars($clone['descr'])?>
121
						</td>
122
						<td>
123
							<a class="fa fa-pencil"	title="<?=gettext('Edit WiFi interface')?>"	href="interfaces_wireless_edit.php?id=<?=$i?>"></a>
124
							<a class="fa fa-trash"	title="<?=gettext('Delete WiFi interface')?>"	href="interfaces_wireless.php?act=del&amp;id=<?=$i?>"></a>
125
						</td>
126
					</tr>
127 719e4eeb sbeaver
<?php
128
	$i++;
129
}
130
?>
131 060ed238 Stephen Beaver
				</tbody>
132
			</table>
133
		</div>
134
	</div>
135 719e4eeb sbeaver
</div>
136 83804723 k-paulius
137
<nav class="action-buttons">
138
	<a href="interfaces_wireless_edit.php" class="btn btn-success btn-sm">
139
		<i class="fa fa-plus icon-embed-btn"></i>
140
		<?=gettext("Add")?></a>
141
</nav>
142 719e4eeb sbeaver
<?php
143
include("foot.inc");