Project

General

Profile

Download (4.89 KB) Statistics
| Branch: | Tag: | Revision:
1 f1f60c92 Ermal Luçi
<?php
2
/* $Id$ */
3
/*
4 ce77a9c4 Phil Davis
	services_rfc2136.php
5
6 1d7ba683 ayvis
	Copyright (C) 2008 Ermal Luçi
7 ce77a9c4 Phil Davis
	Copyright (C) 2013-2015 Electric Sheep Fencing, LP
8 f1f60c92 Ermal Luçi
	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 1d333258 Scott Ullrich
/*
32
	pfSense_MODULE:	dnsupdate
33
*/
34 f1f60c92 Ermal Luçi
35 6b07c15a Matthew Grooms
##|+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 f1f60c92 Ermal Luçi
require("guiconfig.inc");
43
44 efdf8358 Phil Davis
if (!is_array($config['dnsupdates']['dnsupdate'])) {
45 f1f60c92 Ermal Luçi
	$config['dnsupdates']['dnsupdate'] = array();
46 efdf8358 Phil Davis
}
47 f1f60c92 Ermal Luçi
48
$a_rfc2136 = &$config['dnsupdates']['dnsupdate'];
49
50
if ($_GET['act'] == "del") {
51 e766bd84 bcyrill
	unset($a_rfc2136[$_GET['id']]);
52 f1f60c92 Ermal Luçi
53 e766bd84 bcyrill
	write_config();
54 f1f60c92 Ermal Luçi
55 e766bd84 bcyrill
	header("Location: services_rfc2136.php");
56
	exit;
57 f1f60c92 Ermal Luçi
}
58
59 1c108cef Rafael Lucas
$pgtitle = array(gettext("Services"), gettext("RFC 2136 clients"));
60 f1f60c92 Ermal Luçi
include("head.inc");
61 a5d5b1f7 sbeaver
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 f1f60c92 Ermal Luçi
?>
70
71
<form action="services_rfc2136.php" method="post" name="iform" id="iform">
72 a5d5b1f7 sbeaver
	<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 f1f60c92 Ermal Luçi
<?php
86 30a40ca8 sbeaver
87
88
$iflist = get_configured_interface_with_descr();
89
90 a5d5b1f7 sbeaver
$i = 0;
91
foreach ($a_rfc2136 as $rfc2136):
92 f1f60c92 Ermal Luçi
?>
93 30a40ca8 sbeaver
		        <tr <?=(isset($rfc2136['enable']) ? '' : 'class="disabled"')?>">
94 a5d5b1f7 sbeaver
		            <td>
95
<?php
96
	foreach ($iflist as $if => $ifdesc) {
97
	    if ($rfc2136['interface'] == $if) {
98 30a40ca8 sbeaver
	        print($ifdesc);
99 a5d5b1f7 sbeaver
			break;
100
	    }
101
	}
102
?>
103
		            </td>
104
		            <td>
105 30a40ca8 sbeaver
		                <?=htmlspecialchars($rfc2136['server'])?>
106 a5d5b1f7 sbeaver
		            </td>
107
		            <td>
108 30a40ca8 sbeaver
		                <?=htmlspecialchars($rfc2136['host'])?>
109 a5d5b1f7 sbeaver
		            </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 30a40ca8 sbeaver
		                <?=htmlspecialchars($rfc2136['descr'])?>
158 a5d5b1f7 sbeaver
		            </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 f1f60c92 Ermal Luçi
</form>
172 a5d5b1f7 sbeaver
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");