Project

General

Profile

Download (7.03 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_BUILDER_BINARIES:	/usr/bin/host
31
	pfSense_MODULE:	dyndns
32
*/
33

    
34
##|+PRIV
35
##|*IDENT=page-services-dynamicdnsclients
36
##|*NAME=Services: Dynamic DNS clients page
37
##|*DESCR=Allow access to the 'Services: Dynamic DNS clients' page.
38
##|*MATCH=services_dyndns.php*
39
##|-PRIV
40

    
41
require("guiconfig.inc");
42

    
43
if (!is_array($config['dyndnses']['dyndns']))
44
	$config['dyndnses']['dyndns'] = array();
45

    
46
$a_dyndns = &$config['dyndnses']['dyndns'];
47

    
48
if ($_GET['act'] == "del") {
49

    
50
	$conf = $a_dyndns[$_GET['id']];
51
	@unlink("{$g['conf_path']}/dyndns_{$conf['interface']}{$conf['type']}" . escapeshellarg($conf['host']) . "{$conf['id']}.cache");
52
	unset($a_dyndns[$_GET['id']]);
53

    
54
	write_config();
55
	services_dyndns_configure();
56

    
57
	header("Location: services_dyndns.php");
58
	exit;
59
}
60

    
61
$pgtitle = array(gettext("Services"), gettext("Dynamic DNS clients"));
62
include("head.inc");
63

    
64
?>
65

    
66
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
67
<?php include("fbegin.inc"); ?>
68
<form action="services_dyndns.php" method="post" name="iform" id="iform">
69
<?php if ($input_errors) print_input_errors($input_errors); ?>
70
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="dynamic dns">
71
  <tr>
72
	<td>
73
<?php
74
	$tab_array = array();
75
	$tab_array[] = array(gettext("DynDns"), true, "services_dyndns.php");
76
	$tab_array[] = array(gettext("RFC 2136"), false, "services_rfc2136.php");
77
	display_top_tabs($tab_array);
78
?>
79
	</td>
80
  </tr>
81
  <tr>
82
	<td>
83
	  <div id="mainarea">
84
	  <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="main area">
85
		<tr>
86
		  <td width="5%"  class="listhdrr"><?=gettext("Interface");?></td>
87
		  <td width="15%" class="listhdrr"><?=gettext("Service");?></td>
88
		  <td width="20%" class="listhdrr"><?=gettext("Hostname");?></td>
89
		  <td width="20%" class="listhdrr"><?=gettext("Cached IP");?></td>
90
		  <td width="50%" class="listhdr"><?=gettext("Description");?></td>
91
		  <td width="10%" class="list"></td>
92
		</tr>
93
		<?php $i = 0; foreach ($a_dyndns as $dyndns): ?>
94
		<tr ondblclick="document.location='services_dyndns_edit.php?id=<?=$i;?>'">
95
		  <td class="listlr">
96
		  <?php	$iflist = get_configured_interface_with_descr();
97
			foreach ($iflist as $if => $ifdesc) {
98
				if ($dyndns['interface'] == $if) {
99
					if (!isset($dyndns['enable']))
100
						echo "<span class=\"gray\">{$ifdesc}</span>";
101
					else
102
						echo "{$ifdesc}";
103
					break;
104
				}
105
			}
106
			$groupslist = return_gateway_groups_array();
107
			foreach ($groupslist as $if => $group) {
108
				if ($dyndns['interface'] == $if) {
109
					if (!isset($dyndns['enable']))
110
						echo "<span class=\"gray\">{$if}</span>";
111
					else
112
						echo "{$if}";
113
					break;
114
				}
115
			}
116
		  ?>
117
		  </td>
118
		  <td class="listr">
119
		  <?php
120
			$types = explode(",", DYNDNS_PROVIDER_DESCRIPTIONS);
121
			$vals = explode(" ", DYNDNS_PROVIDER_VALUES);
122
			for ($j = 0; $j < count($vals); $j++)
123
				if ($vals[$j] == $dyndns['type']) {
124
					if (!isset($dyndns['enable']))
125
						echo "<span class=\"gray\">" . htmlspecialchars($types[$j]) . "</span>";
126
					else
127
						echo htmlspecialchars($types[$j]);
128
					break;
129
				}
130
		  ?>
131
		  </td>
132
		  <td class="listr">
133
		  <?php
134
			if (!isset($dyndns['enable']))
135
				echo "<span class=\"gray\">" . htmlspecialchars($dyndns['host']) . "</span>";
136
			else
137
				echo htmlspecialchars($dyndns['host']);
138
		  ?>
139
		  </td>
140
		  <td class="listr">
141
		  <?php
142
			$filename = "{$g['conf_path']}/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($dyndns['host']) . "{$dyndns['id']}.cache";
143
			$filename_v6 = "{$g['conf_path']}/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($dyndns['host']) . "{$dyndns['id']}_v6.cache";
144
			if (file_exists($filename)) {
145
				$ipaddr = dyndnsCheckIP($dyndns['interface']);
146
				$cached_ip_s = explode(":", file_get_contents($filename));
147
				$cached_ip = $cached_ip_s[0];
148
				if ($ipaddr <> $cached_ip)
149
					echo "<font color='red'>";
150
				else
151
					echo "<font color='green'>";
152
				echo htmlspecialchars($cached_ip);
153
				echo "</font>";
154
			} else if (file_exists($filename_v6)) {
155
				$ipv6addr = get_interface_ipv6($dyndns['interface']);
156
				$cached_ipv6_s = explode("|", file_get_contents($filename_v6));
157
				$cached_ipv6 = $cached_ipv6_s[0];
158
				if ($ipv6addr <> $cached_ipv6)
159
					echo "<font color='red'>";
160
				else
161
					echo "<font color='green'>";
162
				echo htmlspecialchars($cached_ipv6);
163
				echo "</font>";
164
			} else {
165
				echo "N/A";
166
			}
167
		  ?>
168
		  </td>
169
		  <td class="listbg">
170
		  <?php
171
			if (!isset($dyndns['enable']))
172
				echo "<span class=\"gray\">".htmlspecialchars($dyndns['descr'])."</span>";
173
			else
174
				echo htmlspecialchars($dyndns['descr']);
175
		  ?>
176
		  </td>
177
		  <td valign="middle" class="list nowrap">
178
			<a href="services_dyndns_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" alt="edit" /></a>
179
			&nbsp;<a href="services_dyndns.php?act=del&amp;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" alt="delete" /></a>
180
		  </td>
181
		</tr>
182
		<?php $i++; endforeach; ?>
183
		<tr>
184
		  <td class="list" colspan="5"></td>
185
		  <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" alt="add" /></a></td>
186
		</tr>
187
		<tr>
188
		  <td colspan="5" class="list"><p class="vexpl"><span class="red"><strong>
189
			<?=gettext("Note:");?><br />
190
			</strong></span>
191
			<?=gettext("IP addresses appearing in green are up to date with Dynamic DNS provider.");?><br />
192
			<?=gettext("You can force an update for an IP address on the edit page for that service.");?></p>
193
		  </td>
194
		  <td class="list">&nbsp;</td>
195
		</tr>
196
	  </table>
197
	  </div>
198
	</td>
199
  </tr>
200
</table>
201
</form>
202
<?php include("fend.inc"); ?>
203
</body>
204
</html>
(159-159/256)