Project

General

Profile

Download (6.2 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	Copyright (C) 2008 Ermal Luçi
5
        Copyright (C) 2013-2014 Electric Sheep Fencing, LP
6
	All rights reserved.
7

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

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

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

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

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

    
40
require("guiconfig.inc");
41

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

    
45
$a_rfc2136 = &$config['dnsupdates']['dnsupdate'];
46

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

    
50
	write_config();
51

    
52
	header("Location: services_rfc2136.php");
53
	exit;
54
}
55

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

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