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_BUILDER_BINARIES: /usr/bin/host
|
30
|
pfSense_MODULE: dyndns
|
31
|
*/
|
32
|
|
33
|
##|+PRIV
|
34
|
##|*IDENT=page-services-dynamicdnsclients
|
35
|
##|*NAME=Services: Dynamic DNS clients page
|
36
|
##|*DESCR=Allow access to the 'Services: Dynamic DNS clients' page.
|
37
|
##|*MATCH=services_dyndns.php*
|
38
|
##|-PRIV
|
39
|
|
40
|
require("guiconfig.inc");
|
41
|
|
42
|
if (!is_array($config['dyndnses']['dyndns']))
|
43
|
$config['dyndnses']['dyndns'] = array();
|
44
|
|
45
|
$a_dyndns = &$config['dyndnses']['dyndns'];
|
46
|
|
47
|
if ($_GET['act'] == "del") {
|
48
|
unset($a_dyndns[$_GET['id']]);
|
49
|
|
50
|
for($i = 0; $i < count($a_dyndns); $i++) {
|
51
|
$a_dyndns[$i]['id'] = $i;
|
52
|
}
|
53
|
|
54
|
//FIXME: Instead of rechecking all interfaces and removing the cache files, gracefully move all cache files to the appropriate ID number.
|
55
|
mwexec("/bin/rm {$g['conf_path']}/dyndns_*.cache");
|
56
|
|
57
|
write_config();
|
58
|
services_dyndns_configure();
|
59
|
|
60
|
header("Location: services_dyndns.php");
|
61
|
exit;
|
62
|
}
|
63
|
|
64
|
$pgtitle = array(gettext("Services"), gettext("Dynamic DNS clients"));
|
65
|
include("head.inc");
|
66
|
|
67
|
?>
|
68
|
|
69
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
70
|
<?php include("fbegin.inc"); ?>
|
71
|
<form action="services_dyndns.php" method="post" name="iform" id="iform">
|
72
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
73
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
74
|
<tr>
|
75
|
<td>
|
76
|
<?php
|
77
|
$tab_array = array();
|
78
|
$tab_array[] = array(gettext("DynDns"), true, "services_dyndns.php");
|
79
|
$tab_array[] = array(gettext("RFC 2136"), false, "services_rfc2136.php");
|
80
|
display_top_tabs($tab_array);
|
81
|
?>
|
82
|
</td>
|
83
|
</tr>
|
84
|
<tr>
|
85
|
<td>
|
86
|
<div id="mainarea">
|
87
|
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
|
88
|
<tr>
|
89
|
<td width="5%" class="listhdrr"><?=gettext("Interface");?></td>
|
90
|
<td width="15%" class="listhdrr"><?=gettext("Service");?></td>
|
91
|
<td width="20%" class="listhdrr"><?=gettext("Hostname");?></td>
|
92
|
<td width="20%" class="listhdrr"><?=gettext("Cached IP");?></td>
|
93
|
<td width="50%" class="listhdr"><?=gettext("Description");?></td>
|
94
|
<td width="10%" class="list"></td>
|
95
|
</tr>
|
96
|
<?php $i = 0; foreach ($a_dyndns as $dyndns): ?>
|
97
|
<tr ondblclick="document.location='services_dyndns_edit.php?id=<?=$i;?>'">
|
98
|
<td class="listlr">
|
99
|
<?php $iflist = get_configured_interface_with_descr();
|
100
|
foreach ($iflist as $if => $ifdesc) {
|
101
|
if ($dyndns['interface'] == $if) {
|
102
|
if (!isset($dyndns['enable']))
|
103
|
echo "<span class=\"gray\">{$ifdesc}</span>";
|
104
|
else
|
105
|
echo "{$ifdesc}";
|
106
|
break;
|
107
|
}
|
108
|
}
|
109
|
$groupslist = return_gateway_groups_array();
|
110
|
foreach ($groupslist as $if => $group) {
|
111
|
if ($dyndns['interface'] == $if) {
|
112
|
if (!isset($dyndns['enable']))
|
113
|
echo "<span class=\"gray\">{$if}</span>";
|
114
|
else
|
115
|
echo "{$if}";
|
116
|
break;
|
117
|
}
|
118
|
}
|
119
|
?>
|
120
|
</td>
|
121
|
<td class="listr">
|
122
|
<?php
|
123
|
$types = explode(",", DYNDNS_PROVIDER_DESCRIPTIONS);
|
124
|
$vals = explode(" ", DYNDNS_PROVIDER_VALUES);
|
125
|
for ($j = 0; $j < count($vals); $j++)
|
126
|
if ($vals[$j] == $dyndns['type']) {
|
127
|
if (!isset($dyndns['enable']))
|
128
|
echo "<span class=\"gray\">".htmlspecialchars($types[$j])."</span>";
|
129
|
else
|
130
|
echo htmlspecialchars($types[$j]);
|
131
|
break;
|
132
|
}
|
133
|
?>
|
134
|
</td>
|
135
|
<td class="listr">
|
136
|
<?php
|
137
|
if (!isset($dyndns['enable']))
|
138
|
echo "<span class=\"gray\">".htmlspecialchars($dyndns['host'])."</span>";
|
139
|
else
|
140
|
echo htmlspecialchars($dyndns['host']);
|
141
|
?>
|
142
|
</td>
|
143
|
<td class="listr">
|
144
|
<?php
|
145
|
$filename = "{$g['conf_path']}/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($dyndns['host']) . "{$dyndns['id']}.cache";
|
146
|
if (file_exists($filename)) {
|
147
|
$ipaddr = dyndnsCheckIP($dyndns['interface']);
|
148
|
$cached_ip_s = explode(":", file_get_contents($filename));
|
149
|
$cached_ip = $cached_ip_s[0];
|
150
|
if ($ipaddr <> $cached_ip)
|
151
|
echo "<font color='red'>";
|
152
|
else
|
153
|
echo "<font color='green'>";
|
154
|
echo htmlspecialchars($cached_ip);
|
155
|
echo "</font>";
|
156
|
} else {
|
157
|
echo "N/A";
|
158
|
}
|
159
|
?>
|
160
|
</td>
|
161
|
<td class="listbg">
|
162
|
<?php
|
163
|
if (!isset($dyndns['enable']))
|
164
|
echo "<span class=\"gray\">".htmlspecialchars($dyndns['descr'])."</span>";
|
165
|
else
|
166
|
echo htmlspecialchars($dyndns['descr']);
|
167
|
?>
|
168
|
</td>
|
169
|
<td valign="middle" nowrap class="list">
|
170
|
<a href="services_dyndns_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a>
|
171
|
<a href="services_dyndns.php?act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this entry?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a>
|
172
|
</td>
|
173
|
</tr>
|
174
|
<?php $i++; endforeach; ?>
|
175
|
<tr>
|
176
|
<td class="list" colspan="5"></td>
|
177
|
<td class="list"> <a href="services_dyndns_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td>
|
178
|
</tr>
|
179
|
<tr>
|
180
|
<td colspan="3" class="list"><p class="vexpl"><span class="red"><strong>
|
181
|
<?=gettext("Note:");?><br>
|
182
|
</strong></span>
|
183
|
<?=gettext("IP addresses appearing in green are up to date with Dynamic DNS provider.");?><br>
|
184
|
<?=gettext("You can force an update for an IP address on the edit page for that service.");?>
|
185
|
</td>
|
186
|
<td class="list"> </td>
|
187
|
</tr>
|
188
|
</table>
|
189
|
</div>
|
190
|
</td>
|
191
|
</tr>
|
192
|
</table>
|
193
|
</form>
|
194
|
<?php include("fend.inc"); ?>
|
195
|
</body>
|
196
|
</html>
|