Project

General

Profile

Download (6.22 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
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 e766bd84 bcyrill
	unset($a_rfc2136[$_GET['id']]);
51 f1f60c92 Ermal Luçi
52 e766bd84 bcyrill
	write_config();
53 f1f60c92 Ermal Luçi
54 e766bd84 bcyrill
	header("Location: services_rfc2136.php");
55
	exit;
56 f1f60c92 Ermal Luçi
}
57
58 1c108cef Rafael Lucas
$pgtitle = array(gettext("Services"), gettext("RFC 2136 clients"));
59 f1f60c92 Ermal Luçi
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 d3c90ddd Colin Fleming
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="rfc2136">
67 e766bd84 bcyrill
  <tr>
68
	<td>
69 f1f60c92 Ermal Luçi
<?php
70
	$tab_array = array();
71 1c108cef Rafael Lucas
	$tab_array[] = array(gettext("DynDns"), false, "services_dyndns.php");
72
	$tab_array[] = array(gettext("RFC 2136"), true, "services_rfc2136.php");
73 f1f60c92 Ermal Luçi
	display_top_tabs($tab_array);
74
?>
75 e766bd84 bcyrill
	</td>
76
  </tr>
77 f1f60c92 Ermal Luçi
  <tr>
78 e766bd84 bcyrill
	<td>
79
	  <div id="mainarea">
80 d3c90ddd Colin Fleming
	  <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
81 e766bd84 bcyrill
		<tr>
82 bcafa618 jim-p
		  <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 e766bd84 bcyrill
		  <td width="10%" class="list"></td>
88
		</tr>
89
		<?php $i = 0; foreach ($a_rfc2136 as $rfc2136): ?>
90 a04da9bf jim-p
		<tr ondblclick="document.location='services_rfc2136_edit.php?id=<?=$i;?>'">
91 e766bd84 bcyrill
		  <td class="listlr">
92
		  <?php
93
			$iflist = get_configured_interface_with_descr();
94
			foreach ($iflist as $if => $ifdesc) {
95
				if ($rfc2136['interface'] == $if) {
96 e5da6830 bcyrill
					if (!isset($rfc2136['enable']))
97
						echo "<span class=\"gray\">{$ifdesc}</span>";
98
					else
99
						echo "{$ifdesc}";
100 e766bd84 bcyrill
					break;
101
				}
102
			}
103
		  ?>
104
		  </td>
105
		  <td class="listr">
106 bcafa618 jim-p
		  <?php
107
			if (!isset($rfc2136['enable']))
108 d3c90ddd Colin Fleming
				echo "<span class=\"gray\">" . htmlspecialchars($rfc2136['server']) . "</span>";
109 bcafa618 jim-p
			else
110
				echo htmlspecialchars($rfc2136['server']);
111
		  ?>
112
		  </td>
113
		  <td class="listr">
114 e5da6830 bcyrill
		  <?php
115
			if (!isset($rfc2136['enable']))
116 d3c90ddd Colin Fleming
				echo "<span class=\"gray\">" . htmlspecialchars($rfc2136['host']) . "</span>";
117 e5da6830 bcyrill
			else
118
				echo htmlspecialchars($rfc2136['host']);
119
		  ?>
120 e766bd84 bcyrill
		  </td>
121 bcafa618 jim-p
		  <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 e766bd84 bcyrill
		  <td class="listbg">
159 e5da6830 bcyrill
		  <?php
160
			if (!isset($rfc2136['enable']))
161 d3c90ddd Colin Fleming
				echo "<span class=\"gray\">" . htmlspecialchars($rfc2136['descr']) . "</span>";
162 e5da6830 bcyrill
			else
163
				echo htmlspecialchars($rfc2136['descr']);
164
		  ?>
165 e766bd84 bcyrill
		  </td>
166 d3c90ddd Colin Fleming
		  <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 e766bd84 bcyrill
		  </td>
170
		</tr>
171
		<?php $i++; endforeach; ?>
172
		<tr>
173 bcafa618 jim-p
		  <td class="list" colspan="5">&nbsp;</td>
174 d3c90ddd Colin Fleming
		  <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 e766bd84 bcyrill
		</tr>
176
		<tr>
177
		  <td colspan="3" class="list">
178 1d7ba683 ayvis
			<p class="vexpl"><span class="red"><strong><br /></strong></span></p>
179 e766bd84 bcyrill
		  </td>
180
		  <td class="list">&nbsp;</td>
181
		</tr>
182
	  </table>
183
	  </div>
184 f1f60c92 Ermal Luçi
	</td>
185
	</tr>
186
</table>
187
</form>
188
<?php include("fend.inc"); ?>
189
</body>
190 d3c90ddd Colin Fleming
</html>