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