Project

General

Profile

Download (6.14 KB) Statistics
| Branch: | Tag: | Revision:

univnautes / usr / local / www / services_rfc2136.php @ a1b66bec

1
<?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
/*
29
	pfSense_MODULE:	dnsupdate
30
*/
31

    
32
##|+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
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
	unset($a_rfc2136[$_GET['id']]);
48

    
49
	write_config();
50

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

    
55
$pgtitle = array(gettext("Services"), gettext("RFC 2136 clients"));
56
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" summary="rfc2136">
64
  <tr>
65
	<td>
66
<?php
67
	$tab_array = array();
68
	$tab_array[] = array(gettext("DynDns"), false, "services_dyndns.php");
69
	$tab_array[] = array(gettext("RFC 2136"), true, "services_rfc2136.php");
70
	display_top_tabs($tab_array);
71
?>
72
	</td>
73
  </tr>
74
  <tr>
75
	<td>
76
	  <div id="mainarea">
77
	  <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
78
		<tr>
79
		  <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
		  <td width="10%" class="list"></td>
85
		</tr>
86
		<?php $i = 0; foreach ($a_rfc2136 as $rfc2136): ?>
87
		<tr ondblclick="document.location='services_rfc2136_edit.php?id=<?=$i;?>'">
88
		  <td class="listlr">
89
		  <?php
90
			$iflist = get_configured_interface_with_descr();
91
			foreach ($iflist as $if => $ifdesc) {
92
				if ($rfc2136['interface'] == $if) {
93
					if (!isset($rfc2136['enable']))
94
						echo "<span class=\"gray\">{$ifdesc}</span>";
95
					else
96
						echo "{$ifdesc}";
97
					break;
98
				}
99
			}
100
		  ?>
101
		  </td>
102
		  <td class="listr">
103
		  <?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
		  <?php
112
			if (!isset($rfc2136['enable']))
113
				echo "<span class=\"gray\">" . htmlspecialchars($rfc2136['host']) . "</span>";
114
			else
115
				echo htmlspecialchars($rfc2136['host']);
116
		  ?>
117
		  </td>
118
		  <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
		  <td class="listbg">
156
		  <?php
157
			if (!isset($rfc2136['enable']))
158
				echo "<span class=\"gray\">" . htmlspecialchars($rfc2136['descr']) . "</span>";
159
			else
160
				echo htmlspecialchars($rfc2136['descr']);
161
		  ?>
162
		  </td>
163
		  <td valign="middle" class="list nowrap">
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" alt="edit" /></a>
165
			&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>
166
		  </td>
167
		</tr>
168
		<?php $i++; endforeach; ?>
169
		<tr>
170
		  <td class="list" colspan="5">&nbsp;</td>
171
		  <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>
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
	</td>
182
	</tr>
183
</table>
184
</form>
185
<?php include("fend.inc"); ?>
186
</body>
187
</html>
(166-166/256)