Project

General

Profile

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

    
62
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
63
<?php include("fbegin.inc"); ?>
64
<form action="services_rfc2136.php" method="post" name="iform" id="iform">
65
<?php if ($input_errors) print_input_errors($input_errors); ?>
66
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="rfc2136">
67
  <tr>
68
	<td>
69
<?php
70
	$tab_array = array();
71
	$tab_array[] = array(gettext("DynDns"), false, "services_dyndns.php");
72
	$tab_array[] = array(gettext("RFC 2136"), true, "services_rfc2136.php");
73
	display_top_tabs($tab_array);
74
?>
75
	</td>
76
  </tr>
77
  <tr>
78
	<td>
79
	  <div id="mainarea">
80
	  <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
81
		<tr>
82
		  <td width="5%"  class="listhdrr"><?=gettext("If");?></td>
83
		  <td width="15%" class="listhdrr"><?=gettext("Server");?></td>
84
		  <td width="20%" class="listhdrr"><?=gettext("Hostname");?></td>
85
		  <td width="25%" class="listhdrr"><?=gettext("Cached IP");?></td>
86
		  <td width="25%" class="listhdr"><?=gettext("Description");?></td>
87
		  <td width="10%" class="list"></td>
88
		</tr>
89
		<?php $i = 0; foreach ($a_rfc2136 as $rfc2136): ?>
90
		<tr ondblclick="document.location='services_rfc2136_edit.php?id=<?=$i;?>'">
91
		  <td class="listlr">
92
		  <?php
93
			$iflist = get_configured_interface_with_descr();
94
			foreach ($iflist as $if => $ifdesc) {
95
				if ($rfc2136['interface'] == $if) {
96
					if (!isset($rfc2136['enable']))
97
						echo "<span class=\"gray\">{$ifdesc}</span>";
98
					else
99
						echo "{$ifdesc}";
100
					break;
101
				}
102
			}
103
		  ?>
104
		  </td>
105
		  <td class="listr">
106
		  <?php
107
			if (!isset($rfc2136['enable']))
108
				echo "<span class=\"gray\">" . htmlspecialchars($rfc2136['server']) . "</span>";
109
			else
110
				echo htmlspecialchars($rfc2136['server']);
111
		  ?>
112
		  </td>
113
		  <td class="listr">
114
		  <?php
115
			if (!isset($rfc2136['enable']))
116
				echo "<span class=\"gray\">" . htmlspecialchars($rfc2136['host']) . "</span>";
117
			else
118
				echo htmlspecialchars($rfc2136['host']);
119
		  ?>
120
		  </td>
121
		  <td class="listr">
122
		  <?php
123
			$filename = "{$g['conf_path']}/dyndns_{$rfc2136['interface']}_rfc2136_" . escapeshellarg($rfc2136['host']) . "_{$rfc2136['server']}.cache";
124
			if (file_exists($filename)) {
125
				echo "IPv4: ";
126
				if (isset($rfc2136['usepublicip']))
127
					$ipaddr = dyndnsCheckIP($rfc2136['interface']);
128
				else
129
					$ipaddr = get_interface_ip($rfc2136['interface']);
130
				$cached_ip_s = explode("|", file_get_contents($filename));
131
				$cached_ip = $cached_ip_s[0];
132
				if ($ipaddr <> $cached_ip)
133
					echo "<font color='red'>";
134
				else
135
					echo "<font color='green'>";
136
				echo htmlspecialchars($cached_ip);
137
				echo "</font>";
138
			} else {
139
				echo "IPv4: N/A";
140
			}
141
			echo "<br />";
142
			if (file_exists("{$filename}.ipv6")) {
143
				echo "IPv6: ";
144
				$ipaddr = get_interface_ipv6($rfc2136['interface']);
145
				$cached_ip_s = explode("|", file_get_contents("{$filename}.ipv6"));
146
				$cached_ip = $cached_ip_s[0];
147
				if ($ipaddr <> $cached_ip)
148
					echo "<font color='red'>";
149
				else
150
					echo "<font color='green'>";
151
				echo htmlspecialchars($cached_ip);
152
				echo "</font>";
153
			} else {
154
				echo "IPv6: N/A";
155
			}
156
		  ?>
157
		  </td>
158
		  <td class="listbg">
159
		  <?php
160
			if (!isset($rfc2136['enable']))
161
				echo "<span class=\"gray\">" . htmlspecialchars($rfc2136['descr']) . "</span>";
162
			else
163
				echo htmlspecialchars($rfc2136['descr']);
164
		  ?>
165
		  </td>
166
		  <td valign="middle" class="list nowrap">
167
			<a href="services_rfc2136_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" alt="edit" /></a>
168
			&nbsp;<a href="services_rfc2136.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this client?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="delete" /></a>
169
		  </td>
170
		</tr>
171
		<?php $i++; endforeach; ?>
172
		<tr>
173
		  <td class="list" colspan="5">&nbsp;</td>
174
		  <td class="list"><a href="services_rfc2136_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="add" /></a></td>
175
		</tr>
176
		<tr>
177
		  <td colspan="3" class="list">
178
			<p class="vexpl"><span class="red"><strong><br /></strong></span></p>
179
		  </td>
180
		  <td class="list">&nbsp;</td>
181
		</tr>
182
	  </table>
183
	  </div>
184
	</td>
185
	</tr>
186
</table>
187
</form>
188
<?php include("fend.inc"); ?>
189
</body>
190
</html>
(163-163/252)