Project

General

Profile

Download (5.28 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	services_rfc2136.php
5

    
6
	Copyright (C) 2008 Ermal Luçi
7
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
8
	All rights reserved.
9

    
10
	Redistribution and use in source and binary forms, with or without
11
	modification, are permitted provided that the following conditions are met:
12

    
13
	1. Redistributions of source code must retain the above copyright notice,
14
	   this list of conditions and the following disclaimer.
15

    
16
	2. Redistributions in binary form must reproduce the above copyright
17
	   notice, this list of conditions and the following disclaimer in the
18
	   documentation and/or other materials provided with the distribution.
19

    
20
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
24
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
	POSSIBILITY OF SUCH DAMAGE.
30
*/
31
/*
32
	pfSense_MODULE:	dnsupdate
33
*/
34

    
35
##|+PRIV
36
##|*IDENT=page-services-rfc2136clients
37
##|*NAME=Services: RFC 2136 clients page
38
##|*DESCR=Allow access to the 'Services: RFC 2136 clients' page.
39
##|*MATCH=services_rfc2136.php*
40
##|-PRIV
41

    
42
require("guiconfig.inc");
43

    
44
if (!is_array($config['dnsupdates']['dnsupdate']))
45
	$config['dnsupdates']['dnsupdate'] = array();
46

    
47
$a_rfc2136 = &$config['dnsupdates']['dnsupdate'];
48

    
49
if ($_GET['act'] == "del") {
50
	unset($a_rfc2136[$_GET['id']]);
51

    
52
	write_config();
53

    
54
	header("Location: services_rfc2136.php");
55
	exit;
56
}
57

    
58
$pgtitle = array(gettext("Services"), gettext("RFC 2136 clients"));
59
include("head.inc");
60

    
61
$tab_array = array();
62
$tab_array[] = array(gettext("DynDns"), false, "services_dyndns.php");
63
$tab_array[] = array(gettext("RFC 2136"), true, "services_rfc2136.php");
64
display_top_tabs($tab_array);
65

    
66
if ($input_errors)
67
    print_input_errors($input_errors);
68
?>
69

    
70
<form action="services_rfc2136.php" method="post" name="iform" id="iform">
71
	<div class="table-responsive">
72
		<table class="table table-striped table-hover table-condensed">
73
			<thead>
74
				<tr>
75
        		    <th><?=gettext("If")?></th>
76
        		    <th><?=gettext("Server")?></th>
77
        		    <th><?=gettext("Hostname")?></th>
78
        		    <th><?=gettext("Cached IP")?></th>
79
        		    <th><?=gettext("Description")?></th>
80
		            <th></th>
81
		        </tr>
82
		    </thead>
83
		    <tbody>
84
<?php
85
$i = 0;
86
foreach ($a_rfc2136 as $rfc2136):
87
?>
88
		        <tr>
89
		            <td>
90
<?php
91
    $iflist = get_configured_interface_with_descr();
92

    
93
	foreach ($iflist as $if => $ifdesc) {
94
	    if ($rfc2136['interface'] == $if) {
95
	        if (!isset($rfc2136['enable']))
96
				print('<font color="gray">' . $ifdesc . '</font>');
97
			else
98
				print($ifdesc);
99

    
100
			break;
101
	    }
102
	}
103
?>
104
		            </td>
105
		            <td>
106
<?php
107
	if (!isset($rfc2136['enable']))
108
	    print('<font color="gray">' .  htmlspecialchars($rfc2136['server']) . '</font>');
109
	else
110
		print(htmlspecialchars($rfc2136['server']));
111
?>
112
		            </td>
113
		            <td>
114
<?php
115
	if (!isset($rfc2136['enable']))
116
		print('<font color="gray">' .  htmlspecialchars($rfc2136['host']) . '</font>');
117
	else
118
		print(htmlspecialchars($rfc2136['host']));
119
?>
120
		            </td>
121
		            <td>
122
<?php
123
	$filename = "{$g['conf_path']}/dyndns_{$rfc2136['interface']}_rfc2136_" . escapeshellarg($rfc2136['host']) . "_{$rfc2136['server']}.cache";
124

    
125
	if (file_exists($filename)) {
126
		print('IPv4: ');
127
		if (isset($rfc2136['usepublicip']))
128
			$ipaddr = dyndnsCheckIP($rfc2136['interface']);
129
		else
130
			$ipaddr = get_interface_ip($rfc2136['interface']);
131

    
132
		$cached_ip_s = explode("|", file_get_contents($filename));
133
		$cached_ip = $cached_ip_s[0];
134

    
135
		if ($ipaddr != $cached_ip)
136
			print('<font color="red">');
137
		else
138
			print('<font color="green">');
139

    
140
		print(tmlspecialchars($cached_ip));
141
		print('</font>');
142
	} else {
143
		print('IPv4: N/A');
144
	}
145

    
146
	print('<br />');
147

    
148
	if (file_exists("{$filename}.ipv6")) {
149
		print('IPv6: ');
150
		$ipaddr = get_interface_ipv6($rfc2136['interface']);
151
		$cached_ip_s = explode("|", file_get_contents("{$filename}.ipv6"));
152
		$cached_ip = $cached_ip_s[0];
153

    
154
		if ($ipaddr != $cached_ip)
155
			print('<font color="red">');
156
		else
157
			print('<font color="green">');
158

    
159
		print(htmlspecialchars($cached_ip));
160
		print('</font>');
161
	} else {
162
		print('IPv6: N/A');
163
	}
164

    
165
?>
166
		            </td>
167
		            <td>
168
<?php
169
	if (!isset($rfc2136['enable']))
170
		print('<span class="gray">' . htmlspecialchars($rfc2136['descr']) . '</span>');
171
	else
172
		print(htmlspecialchars($rfc2136['descr']));
173
?>
174
		            </td>
175
		            <td>
176
						<a href="services_rfc2136_edit.php?id=<?=$i?>" class="btn btn-xs btn-info"><?=gettext('Edit')?></a>
177
						<a href="services_rfc2136.php?act=del&amp;id=<?=$i?>" class="btn btn-xs btn-danger"><?=gettext("Delete")?></a>
178
					</td>
179
		        </tr>
180
<?php
181
    $i++;
182
endforeach; ?>
183

    
184
		    </tbody>
185
        </table>
186
    </div>
187
</form>
188

    
189
<nav class="action-buttons">
190
	<a href="services_rfc2136_edit.php" class="btn btn-sm btn-success"><?=gettext('Add')?></a>
191
</nav>
192

    
193
<?php
194
include("foot.inc");
(152-152/241)