Project

General

Profile

Download (4.17 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
 * interfaces_gif.php
4
 *
5
 * part of pfSense (https://www.pfsense.org)
6
 * Copyright (c) 2004-2013 BSD Perimeter
7
 * Copyright (c) 2013-2016 Electric Sheep Fencing
8
 * Copyright (c) 2014-2021 Rubicon Communications, LLC (Netgate)
9
 * All rights reserved.
10
 *
11
 * Licensed under the Apache License, Version 2.0 (the "License");
12
 * you may not use this file except in compliance with the License.
13
 * You may obtain a copy of the License at
14
 *
15
 * http://www.apache.org/licenses/LICENSE-2.0
16
 *
17
 * Unless required by applicable law or agreed to in writing, software
18
 * distributed under the License is distributed on an "AS IS" BASIS,
19
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
 * See the License for the specific language governing permissions and
21
 * limitations under the License.
22
 */
23

    
24
##|+PRIV
25
##|*IDENT=page-interfaces-gif
26
##|*NAME=Interfaces: GIF
27
##|*DESCR=Allow access to the 'Interfaces: GIF' page.
28
##|*MATCH=interfaces_gif.php*
29
##|-PRIV
30

    
31
require_once("guiconfig.inc");
32

    
33
init_config_arr(array('gifs', 'gif'));
34
$a_gifs = &$config['gifs']['gif'] ;
35

    
36
function gif_inuse($num) {
37
	global $config, $a_gifs;
38

    
39
	$iflist = get_configured_interface_list(true);
40
	foreach ($iflist as $if) {
41
		if ($config['interfaces'][$if]['if'] == $a_gifs[$num]['gifif']) {
42
			return true;
43
		}
44
	}
45

    
46
	return false;
47
}
48

    
49
if ($_POST['act'] == "del") {
50
	if (!isset($_POST['id'])) {
51
		$input_errors[] = gettext("Wrong parameters supplied");
52
	} else if (empty($a_gifs[$_POST['id']])) {
53
		$input_errors[] = gettext("Wrong index supplied");
54
	/* check if still in use */
55
	} else if (gif_inuse($_POST['id'])) {
56
		$input_errors[] = gettext("This gif TUNNEL cannot be deleted because it is still being used as an interface.");
57
	} else {
58
		pfSense_interface_destroy($a_gifs[$_POST['id']]['gifif']);
59
		unset($a_gifs[$_POST['id']]);
60

    
61
		write_config("GIF interface deleted");
62

    
63
		header("Location: interfaces_gif.php");
64
		exit;
65
	}
66
}
67

    
68
$pgtitle = array(gettext("Interfaces"), gettext("GIFs"));
69
$shortcut_section = "interfaces";
70
include("head.inc");
71

    
72
if ($input_errors) {
73
	print_input_errors($input_errors);
74
}
75

    
76
$tab_array = array();
77
$tab_array[] = array(gettext("Interface Assignments"), false, "interfaces_assign.php");
78
$tab_array[] = array(gettext("Interface Groups"), false, "interfaces_groups.php");
79
$tab_array[] = array(gettext("Wireless"), false, "interfaces_wireless.php");
80
$tab_array[] = array(gettext("VLANs"), false, "interfaces_vlan.php");
81
$tab_array[] = array(gettext("QinQs"), false, "interfaces_qinq.php");
82
$tab_array[] = array(gettext("PPPs"), false, "interfaces_ppps.php");
83
$tab_array[] = array(gettext("GREs"), false, "interfaces_gre.php");
84
$tab_array[] = array(gettext("GIFs"), true, "interfaces_gif.php");
85
$tab_array[] = array(gettext("Bridges"), false, "interfaces_bridge.php");
86
$tab_array[] = array(gettext("LAGGs"), false, "interfaces_lagg.php");
87
display_top_tabs($tab_array);
88
?>
89
<div class="panel panel-default">
90
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('GIF Interfaces')?></h2></div>
91
	<div class="panel-body">
92
		<div class="table-responsive">
93
			<table class="table table-striped table-hover table-condensed table-rowdblclickedit">
94
				<thead>
95
					<tr>
96
						<th><?=gettext("Interface"); ?></th>
97
						<th><?=gettext("Tunnel to &hellip;"); ?></th>
98
						<th><?=gettext("Description"); ?></th>
99
						<th><?=gettext("Actions"); ?></th>
100
					</tr>
101
				</thead>
102
				<tbody>
103
<?php foreach ($a_gifs as $i => $gif): ?>
104
					<tr>
105
						<td>
106
							<?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($gif['if']))?>
107
						</td>
108
						<td>
109
							<?=htmlspecialchars($gif['remote-addr'])?>
110
						</td>
111
						<td>
112
							<?=htmlspecialchars($gif['descr'])?>
113
						</td>
114
						<td>
115
							<a class="fa fa-pencil"	title="<?=gettext('Edit GIF interface')?>"	href="interfaces_gif_edit.php?id=<?=$i?>"></a>
116
							<a class="fa fa-trash"	title="<?=gettext('Delete GIF interface')?>"	href="interfaces_gif.php?act=del&amp;id=<?=$i?>" usepost></a>
117
						</td>
118
					</tr>
119
<?php endforeach; ?>
120
				</tbody>
121
			</table>
122
		</div>
123
	</div>
124
</div>
125

    
126
<nav class="action-buttons">
127
	<a href="interfaces_gif_edit.php" class="btn btn-success btn-sm">
128
		<i class="fa fa-plus icon-embed-btn"></i>
129
		<?=gettext("Add")?>
130
	</a>
131
</nav>
132

    
133
<?php include("foot.inc");
(75-75/229)