Project

General

Profile

Download (4.27 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-2024 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
config_init_path('gifs/gif');
34

    
35
function gif_inuse($num) {
36
	$a_gifs = config_get_path('gifs/gif');
37
	$iflist = get_configured_interface_list(true);
38
	$if_config = config_get_path('interfaces');
39
	foreach ($iflist as $if) {
40
		if ($if_config[$if]['if'] == $a_gifs[$num]['gifif']) {
41
			return true;
42
		}
43
	}
44

    
45
	return false;
46
}
47

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

    
60
		write_config("GIF interface deleted");
61

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

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

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

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

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

    
132
<?php include("foot.inc");
(77-77/232)