Project

General

Profile

Download (4.06 KB) Statistics
| Branch: | Tag: | Revision:
1 ead45104 Ermal Luçi
<?php
2
/*
3 c5d81585 Renato Botelho
 * interfaces_gif.php
4 b9043cdc Stephen Beaver
 *
5 c5d81585 Renato Botelho
 * part of pfSense (https://www.pfsense.org)
6 0b4c14a4 Steve Beaver
 * Copyright (c) 2004-2019 Rubicon Communications, LLC (Netgate)
7 c5d81585 Renato Botelho
 * All rights reserved.
8 b9043cdc Stephen Beaver
 *
9 b12ea3fb Renato Botelho
 * Licensed under the Apache License, Version 2.0 (the "License");
10
 * you may not use this file except in compliance with the License.
11
 * You may obtain a copy of the License at
12 b9043cdc Stephen Beaver
 *
13 b12ea3fb Renato Botelho
 * http://www.apache.org/licenses/LICENSE-2.0
14 b9043cdc Stephen Beaver
 *
15 b12ea3fb Renato Botelho
 * Unless required by applicable law or agreed to in writing, software
16
 * distributed under the License is distributed on an "AS IS" BASIS,
17
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
 * See the License for the specific language governing permissions and
19
 * limitations under the License.
20 b9043cdc Stephen Beaver
 */
21 ead45104 Ermal Luçi
22 6b07c15a Matthew Grooms
##|+PRIV
23
##|*IDENT=page-interfaces-gif
24 5230f468 jim-p
##|*NAME=Interfaces: GIF
25 6b07c15a Matthew Grooms
##|*DESCR=Allow access to the 'Interfaces: GIF' page.
26
##|*MATCH=interfaces_gif.php*
27
##|-PRIV
28
29 c81ef6e2 Phil Davis
require_once("guiconfig.inc");
30 ead45104 Ermal Luçi
31 c6c398c6 jim-p
init_config_arr(array('gifs', 'gif'));
32 ead45104 Ermal Luçi
$a_gifs = &$config['gifs']['gif'] ;
33
34
function gif_inuse($num) {
35 c059940b Erik Fonnesbeck
	global $config, $a_gifs;
36 ead45104 Ermal Luçi
37 80fe8369 Phil Davis
	$iflist = get_configured_interface_list(true);
38 ead45104 Ermal Luçi
	foreach ($iflist as $if) {
39 2af86dda Phil Davis
		if ($config['interfaces'][$if]['if'] == $a_gifs[$num]['gifif']) {
40 ead45104 Ermal Luçi
			return true;
41 2af86dda Phil Davis
		}
42 ead45104 Ermal Luçi
	}
43
44
	return false;
45
}
46
47 b591908c Steve Beaver
if ($_POST['act'] == "del") {
48
	if (!isset($_POST['id'])) {
49 2af86dda Phil Davis
		$input_errors[] = gettext("Wrong parameters supplied");
50 b591908c Steve Beaver
	} else if (empty($a_gifs[$_POST['id']])) {
51 2af86dda Phil Davis
		$input_errors[] = gettext("Wrong index supplied");
52 ead45104 Ermal Luçi
	/* check if still in use */
53 b591908c Steve Beaver
	} else if (gif_inuse($_POST['id'])) {
54 57d84321 Carlos Eduardo Ramos
		$input_errors[] = gettext("This gif TUNNEL cannot be deleted because it is still being used as an interface.");
55 ead45104 Ermal Luçi
	} else {
56 b591908c Steve Beaver
		pfSense_interface_destroy($a_gifs[$_POST['id']]['gifif']);
57
		unset($a_gifs[$_POST['id']]);
58 ead45104 Ermal Luçi
59
		write_config();
60
61
		header("Location: interfaces_gif.php");
62
		exit;
63
	}
64
}
65
66 26b4bef8 k-paulius
$pgtitle = array(gettext("Interfaces"), gettext("GIFs"));
67 b32dd0a6 jim-p
$shortcut_section = "interfaces";
68 ead45104 Ermal Luçi
include("head.inc");
69 814b5184 sbeaver
70 aa82505e Phil Davis
if ($input_errors) {
71 6a2a3416 sbeaver
	print_input_errors($input_errors);
72 aa82505e Phil Davis
}
73 6a2a3416 sbeaver
74
$tab_array = array();
75 26b4bef8 k-paulius
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
76 c8610c74 Sjon Hortensius
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
77
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
78
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
79
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
80
$tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php");
81 26b4bef8 k-paulius
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
82
$tab_array[] = array(gettext("GIFs"), true, "interfaces_gif.php");
83 c8610c74 Sjon Hortensius
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
84 26b4bef8 k-paulius
$tab_array[] = array(gettext("LAGGs"), false, "interfaces_lagg.php");
85 6a2a3416 sbeaver
display_top_tabs($tab_array);
86 ead45104 Ermal Luçi
?>
87 060ed238 Stephen Beaver
<div class="panel panel-default">
88 70dc5cd6 Phil Davis
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('GIF Interfaces')?></h2></div>
89 060ed238 Stephen Beaver
	<div class="panel-body">
90
		<div class="table-responsive">
91 1c10ce97 PiBa-NL
			<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
92 060ed238 Stephen Beaver
				<thead>
93
					<tr>
94
						<th><?=gettext("Interface"); ?></th>
95
						<th><?=gettext("Tunnel to &hellip;"); ?></th>
96
						<th><?=gettext("Description"); ?></th>
97 70dc5cd6 Phil Davis
						<th><?=gettext("Actions"); ?></th>
98 060ed238 Stephen Beaver
					</tr>
99
				</thead>
100
				<tbody>
101 c8610c74 Sjon Hortensius
<?php foreach ($a_gifs as $i => $gif): ?>
102 060ed238 Stephen Beaver
					<tr>
103
						<td>
104
							<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($gif['if']))?>
105
						</td>
106
						<td>
107
							<?=htmlspecialchars($gif['remote-addr'])?>
108
						</td>
109
						<td>
110
							<?=htmlspecialchars($gif['descr'])?>
111
						</td>
112
						<td>
113 4401107f Steve Beaver
							<a class="fa fa-pencil"	title="<?=gettext('Edit GIF interface')?>"	href="interfaces_gif_edit.php?id=<?=$i?>"></a>
114 b591908c Steve Beaver
							<a class="fa fa-trash"	title="<?=gettext('Delete GIF interface')?>"	href="interfaces_gif.php?act=del&amp;id=<?=$i?>" usepost></a>
115 060ed238 Stephen Beaver
						</td>
116
					</tr>
117 c8610c74 Sjon Hortensius
<?php endforeach; ?>
118 060ed238 Stephen Beaver
				</tbody>
119
			</table>
120
		</div>
121
	</div>
122 6a2a3416 sbeaver
</div>
123
124 c10cb196 Stephen Beaver
<nav class="action-buttons">
125 4401107f Steve Beaver
	<a href="interfaces_gif_edit.php" class="btn btn-success btn-sm">
126 9d5a20cf heper
		<i class="fa fa-plus icon-embed-btn"></i>
127 c8610c74 Sjon Hortensius
		<?=gettext("Add")?>
128
	</a>
129
</nav>
130
131 b76a8ff4 heper
<?php include("foot.inc");