Project

General

Profile

Download (5.17 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
 * services_checkip.php
4
 *
5
 * part of pfSense (https://www.pfsense.org)
6
 * Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
7
 * All rights reserved.
8
 *
9
 * Licensed under the Apache License, Version 2.0 (the "License");
10
 * you may not use this file except in compliance with the License.
11
 * You may obtain a copy of the License at
12
 *
13
 * http://www.apache.org/licenses/LICENSE-2.0
14
 *
15
 * Unless required by applicable law or agreed to in writing, software
16
 * distributed under the License is distributed on an "AS IS" BASIS,
17
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
 * See the License for the specific language governing permissions and
19
 * limitations under the License.
20
 */
21

    
22
##|+PRIV
23
##|*IDENT=page-services-checkipservices
24
##|*NAME=Services: Check IP Service
25
##|*DESCR=Allow access to the 'Services: Check IP Service' page.
26
##|*MATCH=services_checkip.php*
27
##|-PRIV
28

    
29
require_once("guiconfig.inc");
30

    
31
if (!is_array($config['checkipservices']['checkipservice'])) {
32
	$config['checkipservices']['checkipservice'] = array();
33
}
34

    
35
$a_checkipservice = &$config['checkipservices']['checkipservice'];
36

    
37
$dirty = false;
38
if ($_GET['act'] == "del") {
39
	unset($a_checkipservice[$_GET['id']]);
40
	$dirty = true;
41
} else if ($_GET['act'] == "toggle") {
42
	if ($a_checkipservice[$_GET['id']]) {
43
		if (isset($a_checkipservice[$_GET['id']]['enable'])) {
44
			unset($a_checkipservice[$_GET['id']]['enable']);
45
		} else {
46
			$a_checkipservice[$_GET['id']]['enable'] = true;
47
		}
48
		$dirty = true;
49
	} else if ($_GET['id'] == count($a_checkipservice)) {
50
		if (isset($config['checkipservices']['disable_factory_default'])) {
51
			unset($config['checkipservices']['disable_factory_default']);
52
		} else {
53
			$config['checkipservices']['disable_factory_default'] = true;
54
		}
55
		$dirty = true;
56
	}
57
}
58
if ($dirty) {
59
	write_config();
60

    
61
	header("Location: services_checkip.php");
62
	exit;
63
}
64

    
65
$pgtitle = array(gettext("Services"), gettext("Dynamic DNS"), gettext("Check IP Services"));
66
include("head.inc");
67

    
68
$tab_array = array();
69
$tab_array[] = array(gettext("Dynamic DNS Clients"), false, "services_dyndns.php");
70
$tab_array[] = array(gettext("RFC 2136 Clients"), false, "services_rfc2136.php");
71
$tab_array[] = array(gettext("Check IP Services"), true, "services_checkip.php");
72
display_top_tabs($tab_array);
73

    
74
if ($input_errors) {
75
	print_input_errors($input_errors);
76
}
77
?>
78

    
79
<form action="services_checkip.php" method="post" name="iform" id="iform">
80
	<div class="panel panel-default">
81
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('Check IP Services')?></h2></div>
82
		<div class="panel-body">
83
			<div class="table-responsive">
84
				<table class="table table-striped table-hover table-condensed">
85
					<thead>
86
						<tr>
87
							<th><?=gettext("Name")?></th>
88
							<th><?=gettext("URL")?></th>
89
							<th><?=gettext("Verify SSL Peer")?></th>
90
							<th><?=gettext("Description")?></th>
91
							<th><?=gettext("Actions")?></th>
92
						</tr>
93
					</thead>
94
					<tbody>
95
<?php
96
// Is the factory default check IP service disabled?
97
if (isset($config['checkipservices']['disable_factory_default'])) {
98
	unset($factory_default_checkipservice['enable']);
99
}
100

    
101
// Append the factory default check IP service to the list.
102
$a_checkipservice[] = $factory_default_checkipservice;
103
$factory_default = count($a_checkipservice) - 1;
104

    
105
$i = 0;
106
foreach ($a_checkipservice as $checkipservice):
107

    
108
	// Hide edit and delete controls on the factory default check IP service entry (last one; id = count-1), and retain layout positioning.
109
	if ($i == $factory_default) {
110
		$visibility = 'invisible';
111
	} else {
112
		$visibility = 'visible';
113
	}
114
?>
115
						<tr<?=(isset($checkipservice['enable']) ? '' : ' class="disabled"')?>>
116
						<td>
117
							<?=htmlspecialchars($checkipservice['name'])?>
118
						</td>
119
						<td>
120
							<?=htmlspecialchars($checkipservice['url'])?>
121
						</td>
122
						<td class="text-center">
123
							<i<?=(isset($checkipservice['verifysslpeer'])) ? ' class="fa fa-check"' : '';?>></i>
124
						</td>
125
						<td>
126
							<?=htmlspecialchars($checkipservice['descr'])?>
127
						</td>
128
						<td>
129
							<a class="fa fa-pencil <?=$visibility?>" title="<?=gettext('Edit service')?>" href="services_checkip_edit.php?id=<?=$i?>"></a>
130
						<?php if (isset($checkipservice['enable'])) {
131
						?>
132
							<a	class="fa fa-ban" title="<?=gettext('Disable service')?>" href="?act=toggle&amp;id=<?=$i?>"></a>
133
						<?php } else {
134
						?>
135
							<a class="fa fa-check-square-o" title="<?=gettext('Enable service')?>" href="?act=toggle&amp;id=<?=$i?>"></a>
136
						<?php }
137
						?>
138
							<a class="fa fa-trash <?=$visibility?>" title="<?=gettext('Delete service')?>" href="services_checkip.php?act=del&amp;id=<?=$i?>"></a>
139
						</td>
140
					</tr>
141
<?php
142
	$i++;
143
endforeach; ?>
144

    
145
					</tbody>
146
				</table>
147
			</div>
148
		</div>
149
	</div>
150
</form>
151

    
152
<nav class="action-buttons">
153
	<a href="services_checkip_edit.php" class="btn btn-sm btn-success btn-sm">
154
		<i class="fa fa-plus icon-embed-btn"></i>
155
		<?=gettext('Add')?>
156
	</a>
157
</nav>
158

    
159
<div class="infoblock">
160
	<?php print_info_box(gettext(
161
	'The first (highest in list) enabled check ip service will be used to ' . 
162
	'check IP addresses for Dynamic DNS services, and ' .
163
	'RFC 2136 entries that have the "Use public IP" option enabled.'
164
	), 'info', false); ?>
165
</div>
166

    
167
<?php include("foot.inc");
(117-117/227)