Project

General

Profile

Download (4.89 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

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

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

    
53
	write_config();
54

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

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

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

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

    
71
<form action="services_rfc2136.php" method="post" name="iform" id="iform">
72
	<div class="table-responsive">
73
		<table class="table table-striped table-hover table-condensed">
74
			<thead>
75
				<tr>
76
        		    <th><?=gettext("If")?></th>
77
        		    <th><?=gettext("Server")?></th>
78
        		    <th><?=gettext("Hostname")?></th>
79
        		    <th><?=gettext("Cached IP")?></th>
80
        		    <th><?=gettext("Description")?></th>
81
		            <th></th>
82
		        </tr>
83
		    </thead>
84
		    <tbody>
85
<?php
86

    
87

    
88
$iflist = get_configured_interface_with_descr();
89

    
90
$i = 0;
91
foreach ($a_rfc2136 as $rfc2136):
92
?>
93
		        <tr <?=(isset($rfc2136['enable']) ? '' : 'class="disabled"')?>">
94
		            <td>
95
<?php
96
	foreach ($iflist as $if => $ifdesc) {
97
	    if ($rfc2136['interface'] == $if) {
98
	        print($ifdesc);
99
			break;
100
	    }
101
	}
102
?>
103
		            </td>
104
		            <td>
105
		                <?=htmlspecialchars($rfc2136['server'])?>
106
		            </td>
107
		            <td>
108
		                <?=htmlspecialchars($rfc2136['host'])?>
109
		            </td>
110
		            <td>
111
<?php
112
	$filename = "{$g['conf_path']}/dyndns_{$rfc2136['interface']}_rfc2136_" . escapeshellarg($rfc2136['host']) . "_{$rfc2136['server']}.cache";
113

    
114
	if (file_exists($filename)) {
115
		print('IPv4: ');
116
		if (isset($rfc2136['usepublicip']))
117
			$ipaddr = dyndnsCheckIP($rfc2136['interface']);
118
		else
119
			$ipaddr = get_interface_ip($rfc2136['interface']);
120

    
121
		$cached_ip_s = explode("|", file_get_contents($filename));
122
		$cached_ip = $cached_ip_s[0];
123

    
124
		if ($ipaddr != $cached_ip)
125
			print('<font color="red">');
126
		else
127
			print('<font color="green">');
128

    
129
		print(tmlspecialchars($cached_ip));
130
		print('</font>');
131
	} else {
132
		print('IPv4: N/A');
133
	}
134

    
135
	print('<br />');
136

    
137
	if (file_exists("{$filename}.ipv6")) {
138
		print('IPv6: ');
139
		$ipaddr = get_interface_ipv6($rfc2136['interface']);
140
		$cached_ip_s = explode("|", file_get_contents("{$filename}.ipv6"));
141
		$cached_ip = $cached_ip_s[0];
142

    
143
		if ($ipaddr != $cached_ip)
144
			print('<font color="red">');
145
		else
146
			print('<font color="green">');
147

    
148
		print(htmlspecialchars($cached_ip));
149
		print('</font>');
150
	} else {
151
		print('IPv6: N/A');
152
	}
153

    
154
?>
155
		            </td>
156
		            <td>
157
		                <?=htmlspecialchars($rfc2136['descr'])?>
158
		            </td>
159
		            <td>
160
						<a href="services_rfc2136_edit.php?id=<?=$i?>" class="btn btn-xs btn-info"><?=gettext('Edit')?></a>
161
						<a href="services_rfc2136.php?act=del&amp;id=<?=$i?>" class="btn btn-xs btn-danger"><?=gettext("Delete")?></a>
162
					</td>
163
		        </tr>
164
<?php
165
    $i++;
166
endforeach; ?>
167

    
168
		    </tbody>
169
        </table>
170
    </div>
171
</form>
172

    
173
<nav class="action-buttons">
174
	<a href="services_rfc2136_edit.php" class="btn btn-sm btn-success"><?=gettext('Add')?></a>
175
</nav>
176

    
177
<?php
178
include("foot.inc");
(149-149/235)