Project

General

Profile

Download (6.05 KB) Statistics
| Branch: | Tag: | Revision:
1 f1f60c92 Ermal Luçi
<?php
2
/* $Id$ */
3
/*
4
	Copyright (C) 2008 Ermal Lu?i
5
	All rights reserved.
6
7
	Redistribution and use in source and binary forms, with or without
8
	modification, are permitted provided that the following conditions are met:
9
10
	1. Redistributions of source code must retain the above copyright notice,
11
	   this list of conditions and the following disclaimer.
12
13
	2. Redistributions in binary form must reproduce the above copyright
14
	   notice, this list of conditions and the following disclaimer in the
15
	   documentation and/or other materials provided with the distribution.
16
17
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
19
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
20
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
21
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
	POSSIBILITY OF SUCH DAMAGE.
27
*/
28 1d333258 Scott Ullrich
/*
29
	pfSense_MODULE:	dnsupdate
30
*/
31 f1f60c92 Ermal Luçi
32 6b07c15a Matthew Grooms
##|+PRIV
33
##|*IDENT=page-services-rfc2136clients
34
##|*NAME=Services: RFC 2136 clients page
35
##|*DESCR=Allow access to the 'Services: RFC 2136 clients' page.
36
##|*MATCH=services_rfc2136.php*
37
##|-PRIV
38
39 f1f60c92 Ermal Luçi
require("guiconfig.inc");
40
41
if (!is_array($config['dnsupdates']['dnsupdate']))
42
	$config['dnsupdates']['dnsupdate'] = array();
43
44
$a_rfc2136 = &$config['dnsupdates']['dnsupdate'];
45
46
if ($_GET['act'] == "del") {
47 e766bd84 bcyrill
	unset($a_rfc2136[$_GET['id']]);
48 f1f60c92 Ermal Luçi
49 e766bd84 bcyrill
	write_config();
50 f1f60c92 Ermal Luçi
51 e766bd84 bcyrill
	header("Location: services_rfc2136.php");
52
	exit;
53 f1f60c92 Ermal Luçi
}
54
55 1c108cef Rafael Lucas
$pgtitle = array(gettext("Services"), gettext("RFC 2136 clients"));
56 f1f60c92 Ermal Luçi
include("head.inc");
57
?>
58
59
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
60
<?php include("fbegin.inc"); ?>
61
<form action="services_rfc2136.php" method="post" name="iform" id="iform">
62
<?php if ($input_errors) print_input_errors($input_errors); ?>
63
<table width="100%" border="0" cellpadding="0" cellspacing="0">
64 e766bd84 bcyrill
  <tr>
65
	<td>
66 f1f60c92 Ermal Luçi
<?php
67
	$tab_array = array();
68 1c108cef Rafael Lucas
	$tab_array[] = array(gettext("DynDns"), false, "services_dyndns.php");
69
	$tab_array[] = array(gettext("RFC 2136"), true, "services_rfc2136.php");
70 f1f60c92 Ermal Luçi
	display_top_tabs($tab_array);
71
?>
72 e766bd84 bcyrill
	</td>
73
  </tr>
74 f1f60c92 Ermal Luçi
  <tr>
75 e766bd84 bcyrill
	<td>
76
	  <div id="mainarea">
77
	  <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
78
		<tr>
79 0d7e2478 jim-p
		  <td width="5%"  class="listhdrr"><?=gettext("If");?></td>
80
		  <td width="15%" class="listhdrr"><?=gettext("Server");?></td>
81
		  <td width="20%" class="listhdrr"><?=gettext("Hostname");?></td>
82
		  <td width="25%" class="listhdrr"><?=gettext("Cached IP");?></td>
83
		  <td width="25%" class="listhdr"><?=gettext("Description");?></td>
84 e766bd84 bcyrill
		  <td width="10%" class="list"></td>
85
		</tr>
86
		<?php $i = 0; foreach ($a_rfc2136 as $rfc2136): ?>
87 6c38268e jim-p
		<tr ondblclick="document.location='services_rfc2136_edit.php?id=<?=$i;?>'">
88 e766bd84 bcyrill
		  <td class="listlr">
89
		  <?php
90
			$iflist = get_configured_interface_with_descr();
91
			foreach ($iflist as $if => $ifdesc) {
92
				if ($rfc2136['interface'] == $if) {
93 e5da6830 bcyrill
					if (!isset($rfc2136['enable']))
94
						echo "<span class=\"gray\">{$ifdesc}</span>";
95
					else
96
						echo "{$ifdesc}";
97 e766bd84 bcyrill
					break;
98
				}
99
			}
100
		  ?>
101
		  </td>
102
		  <td class="listr">
103 0d7e2478 jim-p
		  <?php
104
			if (!isset($rfc2136['enable']))
105
				echo "<span class=\"gray\">".htmlspecialchars($rfc2136['server'])."</span>";
106
			else
107
				echo htmlspecialchars($rfc2136['server']);
108
		  ?>
109
		  </td>
110
		  <td class="listr">
111 e5da6830 bcyrill
		  <?php
112
			if (!isset($rfc2136['enable']))
113
				echo "<span class=\"gray\">".htmlspecialchars($rfc2136['host'])."</span>";
114
			else
115
				echo htmlspecialchars($rfc2136['host']);
116
		  ?>
117 e766bd84 bcyrill
		  </td>
118 0d7e2478 jim-p
		  <td class="listr">
119
		  <?php
120
			$filename = "{$g['conf_path']}/dyndns_{$rfc2136['interface']}_rfc2136_" . escapeshellarg($rfc2136['host']) . "_{$rfc2136['server']}.cache";
121
			if (file_exists($filename)) {
122
				echo "IPv4: ";
123
				if (isset($rfc2136['usepublicip']))
124
					$ipaddr = dyndnsCheckIP($rfc2136['interface']);
125
				else
126
					$ipaddr = get_interface_ip($rfc2136['interface']);
127
				$cached_ip_s = explode("|", file_get_contents($filename));
128
				$cached_ip = $cached_ip_s[0];
129
				if ($ipaddr <> $cached_ip)
130
					echo "<font color='red'>";
131
				else
132
					echo "<font color='green'>";
133
				echo htmlspecialchars($cached_ip);
134
				echo "</font>";
135
			} else {
136
				echo "IPv4: N/A";
137
			}
138
			echo "<br />";
139
			if (file_exists("{$filename}.ipv6")) {
140
				echo "IPv6: ";
141
				$ipaddr = get_interface_ipv6($rfc2136['interface']);
142
				$cached_ip_s = explode("|", file_get_contents("{$filename}.ipv6"));
143
				$cached_ip = $cached_ip_s[0];
144
				if ($ipaddr <> $cached_ip)
145
					echo "<font color='red'>";
146
				else
147
					echo "<font color='green'>";
148
				echo htmlspecialchars($cached_ip);
149
				echo "</font>";
150
			} else {
151
				echo "IPv6: N/A";
152
			}
153
		  ?>
154
		  </td>
155 e766bd84 bcyrill
		  <td class="listbg">
156 e5da6830 bcyrill
		  <?php
157
			if (!isset($rfc2136['enable']))
158
				echo "<span class=\"gray\">".htmlspecialchars($rfc2136['descr'])."</span>";
159
			else
160
				echo htmlspecialchars($rfc2136['descr']);
161
		  ?>
162 e766bd84 bcyrill
		  </td>
163
		  <td valign="middle" nowrap class="list">
164
			<a href="services_rfc2136_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a>
165 e5da6830 bcyrill
			&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"></a>
166 e766bd84 bcyrill
		  </td>
167
		</tr>
168
		<?php $i++; endforeach; ?>
169
		<tr>
170 0d7e2478 jim-p
		  <td class="list" colspan="5">&nbsp;</td>
171 e766bd84 bcyrill
		  <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"></a></td>
172
		</tr>
173
		<tr>
174
		  <td colspan="3" class="list">
175
			<p class="vexpl"><span class="red"><strong><br></strong></span></p>
176
		  </td>
177
		  <td class="list">&nbsp;</td>
178
		</tr>
179
	  </table>
180
	  </div>
181 f1f60c92 Ermal Luçi
	</td>
182
	</tr>
183
</table>
184
</form>
185
<?php include("fend.inc"); ?>
186
</body>
187 e766bd84 bcyrill
</html>