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
$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

    
86

    
87
$iflist = get_configured_interface_with_descr();
88

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

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

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

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

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

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

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

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

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

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

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

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

    
176
<?php
177
include("foot.inc");
(148-148/237)