Project

General

Profile

Download (4.16 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-2018 Rubicon Communications, LLC (Netgate)
7
 * All rights reserved.
8
 *
9
 * 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
 *
13
 * http://www.apache.org/licenses/LICENSE-2.0
14
 *
15
 * 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
 */
21

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

    
29
require_once("guiconfig.inc");
30

    
31
if (!is_array($config['gifs'])) {
32
	$config['gifs'] = array();
33
}
34
if (!is_array($config['gifs']['gif'])) {
35
	$config['gifs']['gif'] = array();
36
}
37

    
38
$a_gifs = &$config['gifs']['gif'] ;
39

    
40
function gif_inuse($num) {
41
	global $config, $a_gifs;
42

    
43
	$iflist = get_configured_interface_list(true);
44
	foreach ($iflist as $if) {
45
		if ($config['interfaces'][$if]['if'] == $a_gifs[$num]['gifif']) {
46
			return true;
47
		}
48
	}
49

    
50
	return false;
51
}
52

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

    
65
		write_config();
66

    
67
		header("Location: interfaces_gif.php");
68
		exit;
69
	}
70
}
71

    
72
$pgtitle = array(gettext("Interfaces"), gettext("GIFs"));
73
$shortcut_section = "interfaces";
74
include("head.inc");
75

    
76
if ($input_errors) {
77
	print_input_errors($input_errors);
78
}
79

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

    
130
<nav class="action-buttons">
131
	<a href="interfaces_gif_edit.php" class="btn btn-success btn-sm">
132
		<i class="fa fa-plus icon-embed-btn"></i>
133
		<?=gettext("Add")?>
134
	</a>
135
</nav>
136

    
137
<?php include("foot.inc");
(75-75/234)