1 |
b89bc607
|
Phil Davis
|
<?php
|
2 |
|
|
/*
|
3 |
|
|
services_checkip.php
|
4 |
|
|
*/
|
5 |
|
|
/* ====================================================================
|
6 |
2a2396a6
|
Renato Botelho
|
* Copyright (c) 2004-2015 Rubicon Communications, LLC (Netgate). All rights reserved.
|
7 |
b89bc607
|
Phil Davis
|
*
|
8 |
|
|
* Redistribution and use in source and binary forms, with or without modification,
|
9 |
|
|
* 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
|
16 |
|
|
* the documentation and/or other materials provided with the
|
17 |
|
|
* distribution.
|
18 |
|
|
*
|
19 |
|
|
* 3. All advertising materials mentioning features or use of this software
|
20 |
|
|
* must display the following acknowledgment:
|
21 |
|
|
* "This product includes software developed by the pfSense Project
|
22 |
|
|
* for use in the pfSense software distribution. (http://www.pfsense.org/).
|
23 |
|
|
*
|
24 |
|
|
* 4. The names "pfSense" and "pfSense Project" must not be used to
|
25 |
|
|
* endorse or promote products derived from this software without
|
26 |
|
|
* prior written permission. For written permission, please contact
|
27 |
|
|
* coreteam@pfsense.org.
|
28 |
|
|
*
|
29 |
|
|
* 5. Products derived from this software may not be called "pfSense"
|
30 |
|
|
* nor may "pfSense" appear in their names without prior written
|
31 |
|
|
* permission of the Electric Sheep Fencing, LLC.
|
32 |
|
|
*
|
33 |
|
|
* 6. Redistributions of any form whatsoever must retain the following
|
34 |
|
|
* acknowledgment:
|
35 |
|
|
*
|
36 |
|
|
* "This product includes software developed by the pfSense Project
|
37 |
|
|
* for use in the pfSense software distribution (http://www.pfsense.org/).
|
38 |
|
|
*
|
39 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
|
40 |
|
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
41 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
42 |
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
|
43 |
|
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
44 |
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
45 |
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
46 |
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
47 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
48 |
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
49 |
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
50 |
|
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
51 |
|
|
*
|
52 |
|
|
* ====================================================================
|
53 |
|
|
*
|
54 |
|
|
*/
|
55 |
|
|
|
56 |
|
|
##|+PRIV
|
57 |
|
|
##|*IDENT=page-services-checkipservices
|
58 |
|
|
##|*NAME=Services: Check IP Service
|
59 |
|
|
##|*DESCR=Allow access to the 'Services: Check IP Service' page.
|
60 |
|
|
##|*MATCH=services_checkip.php*
|
61 |
|
|
##|-PRIV
|
62 |
|
|
|
63 |
|
|
require_once("guiconfig.inc");
|
64 |
|
|
|
65 |
|
|
if (!is_array($config['checkipservices']['checkipservice'])) {
|
66 |
|
|
$config['checkipservices']['checkipservice'] = array();
|
67 |
|
|
}
|
68 |
|
|
|
69 |
|
|
$a_checkipservice = &$config['checkipservices']['checkipservice'];
|
70 |
|
|
|
71 |
|
|
$dirty = false;
|
72 |
|
|
if ($_GET['act'] == "del") {
|
73 |
|
|
unset($a_checkipservice[$_GET['id']]);
|
74 |
|
|
$dirty = true;
|
75 |
|
|
} else if ($_GET['act'] == "toggle") {
|
76 |
|
|
if ($a_checkipservice[$_GET['id']]) {
|
77 |
|
|
if (isset($a_checkipservice[$_GET['id']]['enable'])) {
|
78 |
|
|
unset($a_checkipservice[$_GET['id']]['enable']);
|
79 |
|
|
} else {
|
80 |
|
|
$a_checkipservice[$_GET['id']]['enable'] = true;
|
81 |
|
|
}
|
82 |
|
|
$dirty = true;
|
83 |
|
|
} else if ($_GET['id'] == count($a_checkipservice)) {
|
84 |
|
|
if (isset($config['checkipservices']['disable_factory_default'])) {
|
85 |
|
|
unset($config['checkipservices']['disable_factory_default']);
|
86 |
|
|
} else {
|
87 |
|
|
$config['checkipservices']['disable_factory_default'] = true;
|
88 |
|
|
}
|
89 |
|
|
$dirty = true;
|
90 |
|
|
}
|
91 |
|
|
}
|
92 |
|
|
if ($dirty) {
|
93 |
|
|
write_config();
|
94 |
|
|
|
95 |
|
|
header("Location: services_checkip.php");
|
96 |
|
|
exit;
|
97 |
|
|
}
|
98 |
|
|
|
99 |
|
|
$pgtitle = array(gettext("Services"), gettext("Dynamic DNS"), gettext("Check IP Services"));
|
100 |
|
|
include("head.inc");
|
101 |
|
|
|
102 |
|
|
$tab_array = array();
|
103 |
|
|
$tab_array[] = array(gettext("Dynamic DNS Clients"), false, "services_dyndns.php");
|
104 |
|
|
$tab_array[] = array(gettext("RFC 2136 Clients"), false, "services_rfc2136.php");
|
105 |
|
|
$tab_array[] = array(gettext("Check IP Services"), true, "services_checkip.php");
|
106 |
|
|
display_top_tabs($tab_array);
|
107 |
|
|
|
108 |
|
|
if ($input_errors) {
|
109 |
|
|
print_input_errors($input_errors);
|
110 |
|
|
}
|
111 |
|
|
?>
|
112 |
|
|
|
113 |
|
|
<form action="services_checkip.php" method="post" name="iform" id="iform">
|
114 |
|
|
<div class="panel panel-default">
|
115 |
|
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext('Check IP Services')?></h2></div>
|
116 |
|
|
<div class="panel-body">
|
117 |
|
|
<div class="table-responsive">
|
118 |
|
|
<table class="table table-striped table-hover table-condensed">
|
119 |
|
|
<thead>
|
120 |
|
|
<tr>
|
121 |
|
|
<th><?=gettext("Name")?></th>
|
122 |
|
|
<th><?=gettext("URL")?></th>
|
123 |
|
|
<th><?=gettext("Verify SSL Peer")?></th>
|
124 |
|
|
<th><?=gettext("Description")?></th>
|
125 |
|
|
<th><?=gettext("Actions")?></th>
|
126 |
|
|
</tr>
|
127 |
|
|
</thead>
|
128 |
|
|
<tbody>
|
129 |
|
|
<?php
|
130 |
|
|
// Is the factory default check IP service disabled?
|
131 |
|
|
if (isset($config['checkipservices']['disable_factory_default'])) {
|
132 |
|
|
unset($factory_default_checkipservice['enable']);
|
133 |
|
|
}
|
134 |
|
|
|
135 |
|
|
// Append the factory default check IP service to the list.
|
136 |
|
|
$a_checkipservice[] = $factory_default_checkipservice;
|
137 |
|
|
$factory_default = count($a_checkipservice) - 1;
|
138 |
|
|
|
139 |
|
|
$i = 0;
|
140 |
|
|
foreach ($a_checkipservice as $checkipservice):
|
141 |
|
|
|
142 |
|
|
// Hide edit and delete controls on the factory default check IP service entry (last one; id = count-1), and retain layout positioning.
|
143 |
|
|
if ($i == $factory_default) {
|
144 |
|
|
$visibility = 'invisible';
|
145 |
|
|
} else {
|
146 |
|
|
$visibility = 'visible';
|
147 |
|
|
}
|
148 |
|
|
?>
|
149 |
|
|
<tr<?=(isset($checkipservice['enable']) ? '' : ' class="disabled"')?>>
|
150 |
|
|
<td>
|
151 |
|
|
<?=htmlspecialchars($checkipservice['name'])?>
|
152 |
|
|
</td>
|
153 |
|
|
<td>
|
154 |
|
|
<?=htmlspecialchars($checkipservice['url'])?>
|
155 |
|
|
</td>
|
156 |
|
|
<td class="text-center">
|
157 |
|
|
<i<?=(isset($checkipservice['verifysslpeer'])) ? ' class="fa fa-check"' : '';?>></i>
|
158 |
|
|
</td>
|
159 |
|
|
<td>
|
160 |
|
|
<?=htmlspecialchars($checkipservice['descr'])?>
|
161 |
|
|
</td>
|
162 |
|
|
<td>
|
163 |
|
|
<a class="fa fa-pencil <?=$visibility?>" title="<?=gettext('Edit service')?>" href="services_checkip_edit.php?id=<?=$i?>"></a>
|
164 |
|
|
<?php if (isset($checkipservice['enable'])) {
|
165 |
|
|
?>
|
166 |
|
|
<a class="fa fa-ban" title="<?=gettext('Disable service')?>" href="?act=toggle&id=<?=$i?>"></a>
|
167 |
|
|
<?php } else {
|
168 |
|
|
?>
|
169 |
|
|
<a class="fa fa-check-square-o" title="<?=gettext('Enable service')?>" href="?act=toggle&id=<?=$i?>"></a>
|
170 |
|
|
<?php }
|
171 |
|
|
?>
|
172 |
|
|
<a class="fa fa-trash <?=$visibility?>" title="<?=gettext('Delete service')?>" href="services_checkip.php?act=del&id=<?=$i?>"></a>
|
173 |
|
|
</td>
|
174 |
|
|
</tr>
|
175 |
|
|
<?php
|
176 |
|
|
$i++;
|
177 |
|
|
endforeach; ?>
|
178 |
|
|
|
179 |
|
|
</tbody>
|
180 |
|
|
</table>
|
181 |
|
|
</div>
|
182 |
|
|
</div>
|
183 |
|
|
</div>
|
184 |
|
|
</form>
|
185 |
|
|
|
186 |
|
|
<nav class="action-buttons">
|
187 |
|
|
<a href="services_checkip_edit.php" class="btn btn-sm btn-success btn-sm">
|
188 |
|
|
<i class="fa fa-plus icon-embed-btn"></i>
|
189 |
|
|
<?=gettext('Add')?>
|
190 |
|
|
</a>
|
191 |
|
|
</nav>
|
192 |
|
|
|
193 |
99896968
|
NOYB
|
<div class="infoblock">
|
194 |
a016674e
|
NOYB
|
<?php print_info_box(gettext(
|
195 |
99896968
|
NOYB
|
'The first (highest in list) enabled check ip service will be used to ' .
|
196 |
|
|
'check IP addresses for Dynamic DNS services, and ' .
|
197 |
a016674e
|
NOYB
|
'RFC 2136 entries that have the "Use public IP" option enabled.'
|
198 |
|
|
), 'info', false); ?>
|
199 |
99896968
|
NOYB
|
</div>
|
200 |
|
|
|
201 |
|
|
<?php include("foot.inc");
|