Project

General

Profile

Download (6.88 KB) Statistics
| Branch: | Tag: | Revision:
1 d03efa9c Scott Ullrich
<?php
2 b46bfcf5 Bill Marquette
/* $Id$ */
3 5b237745 Scott Ullrich
/*
4 14aee2f4 Phil Davis
	Copyright (C) 2008 Ermal Luçi
5 5b237745 Scott Ullrich
	All rights reserved.
6 d03efa9c Scott Ullrich
7 5b237745 Scott Ullrich
	Redistribution and use in source and binary forms, with or without
8
	modification, are permitted provided that the following conditions are met:
9 d03efa9c Scott Ullrich
10 5b237745 Scott Ullrich
	1. Redistributions of source code must retain the above copyright notice,
11
	   this list of conditions and the following disclaimer.
12 d03efa9c Scott Ullrich
13 5b237745 Scott Ullrich
	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 d03efa9c Scott Ullrich
17 5b237745 Scott Ullrich
	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_BUILDER_BINARIES:	/usr/bin/host	
30
	pfSense_MODULE:	dyndns
31
*/
32 5b237745 Scott Ullrich
33 6b07c15a Matthew Grooms
##|+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 5b237745 Scott Ullrich
require("guiconfig.inc");
41
42 f1f60c92 Ermal Luçi
if (!is_array($config['dyndnses']['dyndns']))
43
	$config['dyndnses']['dyndns'] = array();
44 5b237745 Scott Ullrich
45 f1f60c92 Ermal Luçi
$a_dyndns = &$config['dyndnses']['dyndns'];
46 d03efa9c Scott Ullrich
47 f1f60c92 Ermal Luçi
if ($_GET['act'] == "del") {
48 37f3e704 Matt Corallo
49 f42193a4 Ermal
	$conf = $a_dyndns[$_GET['id']];
50
	@unlink("{$g['conf_path']}/dyndns_{$conf['interface']}{$conf['type']}" . escapeshellarg($conf['host']) . "{$conf['id']}.cache");
51
	unset($a_dyndns[$_GET['id']]);
52 37f3e704 Matt Corallo
53 5a39eb2b bcyrill
	write_config();
54
	services_dyndns_configure();
55 37f3e704 Matt Corallo
56 5a39eb2b bcyrill
	header("Location: services_dyndns.php");
57
	exit;
58 5b237745 Scott Ullrich
}
59 4df96eff Scott Ullrich
60 c55f0507 Rafael Lucas
$pgtitle = array(gettext("Services"), gettext("Dynamic DNS clients"));
61 4df96eff Scott Ullrich
include("head.inc");
62
63 5b237745 Scott Ullrich
?>
64 4df96eff Scott Ullrich
65 5b237745 Scott Ullrich
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
66
<?php include("fbegin.inc"); ?>
67 f1f60c92 Ermal Luçi
<form action="services_dyndns.php" method="post" name="iform" id="iform">
68 5b237745 Scott Ullrich
<?php if ($input_errors) print_input_errors($input_errors); ?>
69 f1f60c92 Ermal Luçi
<table width="100%" border="0" cellpadding="0" cellspacing="0">
70 5a39eb2b bcyrill
  <tr>
71
	<td>
72 f1f60c92 Ermal Luçi
<?php
73
	$tab_array = array();
74 9a8d5eaf Carlos Eduardo Ramos
	$tab_array[] = array(gettext("DynDns"), true, "services_dyndns.php");
75
	$tab_array[] = array(gettext("RFC 2136"), false, "services_rfc2136.php");
76 f1f60c92 Ermal Luçi
	display_top_tabs($tab_array);
77
?>
78 5a39eb2b bcyrill
	</td>
79
  </tr>
80 f1f60c92 Ermal Luçi
  <tr>
81 5a39eb2b bcyrill
	<td>
82
	  <div id="mainarea">
83
	  <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
84
		<tr>
85 3e1eec58 smos
		  <td width="5%"  class="listhdrr"><?=gettext("Interface");?></td>
86 c55f0507 Rafael Lucas
		  <td width="15%" class="listhdrr"><?=gettext("Service");?></td>
87 5a39eb2b bcyrill
		  <td width="20%" class="listhdrr"><?=gettext("Hostname");?></td>
88
		  <td width="20%" class="listhdrr"><?=gettext("Cached IP");?></td>
89
		  <td width="50%" class="listhdr"><?=gettext("Description");?></td>
90
		  <td width="10%" class="list"></td>
91 23e69ae8 Ermal Lu?i
		</tr>
92 5a39eb2b bcyrill
		<?php $i = 0; foreach ($a_dyndns as $dyndns): ?>
93
		<tr ondblclick="document.location='services_dyndns_edit.php?id=<?=$i;?>'">
94 23e69ae8 Ermal Lu?i
		  <td class="listlr">
95 5a39eb2b bcyrill
		  <?php	$iflist = get_configured_interface_with_descr();
96
			foreach ($iflist as $if => $ifdesc) {
97 3e1eec58 smos
				if ($dyndns['interface'] == $if) {
98 51ce2ea7 bcyrill
					if (!isset($dyndns['enable']))
99
						echo "<span class=\"gray\">{$ifdesc}</span>";
100
					else
101
						echo "{$ifdesc}";
102 3e1eec58 smos
					break;
103
				}
104
			}
105
			$groupslist = return_gateway_groups_array();
106 ab4ce295 bcyrill
			foreach ($groupslist as $if => $group) {
107 bf001dec smos
				if ($dyndns['interface'] == $if) {
108 51ce2ea7 bcyrill
					if (!isset($dyndns['enable']))
109
						echo "<span class=\"gray\">{$if}</span>";
110
					else
111
						echo "{$if}";
112 3e1eec58 smos
					break;
113
				}
114
			}
115 5a39eb2b bcyrill
		  ?>
116 23e69ae8 Ermal Lu?i
		  </td>
117 5a39eb2b bcyrill
		  <td class="listr">
118
		  <?php
119 14aee2f4 Phil Davis
			$types = explode(",", DYNDNS_PROVIDER_DESCRIPTIONS);
120
			$vals = explode(" ", DYNDNS_PROVIDER_VALUES);
121 51ce2ea7 bcyrill
			for ($j = 0; $j < count($vals); $j++) 
122
				if ($vals[$j] == $dyndns['type']) {
123
					if (!isset($dyndns['enable']))
124
						echo "<span class=\"gray\">".htmlspecialchars($types[$j])."</span>";
125
					else
126
						echo htmlspecialchars($types[$j]);
127 5a39eb2b bcyrill
					break;
128 23e69ae8 Ermal Lu?i
				}
129 5a39eb2b bcyrill
		  ?>
130
		  </td>
131
		  <td class="listr">
132 51ce2ea7 bcyrill
		  <?php
133
			if (!isset($dyndns['enable']))
134
				echo "<span class=\"gray\">".htmlspecialchars($dyndns['host'])."</span>";
135
			else
136
				echo htmlspecialchars($dyndns['host']);
137
		  ?>
138 5a39eb2b bcyrill
		  </td>
139
		  <td class="listr">
140
		  <?php
141 ab4ce295 bcyrill
			$filename = "{$g['conf_path']}/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($dyndns['host']) . "{$dyndns['id']}.cache";
142 93749c10 Daniel Becker
			$filename_v6 = "{$g['conf_path']}/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($dyndns['host']) . "{$dyndns['id']}_v6.cache";
143 5a39eb2b bcyrill
			if (file_exists($filename)) {
144 ab4ce295 bcyrill
				$ipaddr = dyndnsCheckIP($dyndns['interface']);
145 5a39eb2b bcyrill
				$cached_ip_s = explode(":", file_get_contents($filename));
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 93749c10 Daniel Becker
			} else if (file_exists($filename_v6)) {
154
				$ipv6addr = get_interface_ipv6($dyndns['interface']);
155 c3101e14 Daniel Becker
				$cached_ipv6_s = explode("|", file_get_contents($filename_v6));
156 93749c10 Daniel Becker
				$cached_ipv6 = $cached_ipv6_s[0];
157
				if ($ipv6addr <> $cached_ipv6) 
158
					echo "<font color='red'>";
159
				else 
160
					echo "<font color='green'>";
161
				echo htmlspecialchars($cached_ipv6);
162
				echo "</font>";
163 5a39eb2b bcyrill
			} else {
164
				echo "N/A";
165
			}
166
		  ?>
167 23e69ae8 Ermal Lu?i
		  </td>
168 5a39eb2b bcyrill
		  <td class="listbg">
169 51ce2ea7 bcyrill
		  <?php
170
			if (!isset($dyndns['enable']))
171
				echo "<span class=\"gray\">".htmlspecialchars($dyndns['descr'])."</span>";
172
			else
173
				echo htmlspecialchars($dyndns['descr']);
174
		  ?>
175 5a39eb2b bcyrill
		  </td>
176
		  <td valign="middle" nowrap class="list">
177
			<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>
178 51ce2ea7 bcyrill
			&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"></a>
179 5a39eb2b bcyrill
		  </td>
180
		</tr>
181
		<?php $i++; endforeach; ?>
182
		<tr>
183
		  <td class="list" colspan="5"></td>
184
		  <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>
185
		</tr>
186
		<tr>
187
		  <td colspan="3" class="list"><p class="vexpl"><span class="red"><strong>
188
			<?=gettext("Note:");?><br>
189
			</strong></span>
190
			<?=gettext("IP addresses appearing in green are up to date with Dynamic DNS provider.");?><br>
191
			<?=gettext("You can force an update for an IP address on the edit page for that service.");?>
192
		  </td>
193
		  <td class="list">&nbsp;</td>
194
		</tr>
195
	  </table>
196
	  </div>
197 f1f60c92 Ermal Luçi
	</td>
198 5a39eb2b bcyrill
  </tr>
199 f1f60c92 Ermal Luçi
</table>
200 5b237745 Scott Ullrich
</form>
201
<?php include("fend.inc"); ?>
202
</body>
203
</html>