1
|
<?php
|
2
|
/*
|
3
|
* status_services.php
|
4
|
*
|
5
|
* part of pfSense (https://www.pfsense.org)
|
6
|
* Copyright (c) 2004-2018 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-status-services
|
24
|
##|*NAME=Status: Services
|
25
|
##|*DESCR=Allow access to the 'Status: Services' page.
|
26
|
##|*MATCH=status_services.php*
|
27
|
##|-PRIV
|
28
|
|
29
|
require_once("guiconfig.inc");
|
30
|
require_once("service-utils.inc");
|
31
|
require_once("shortcuts.inc");
|
32
|
|
33
|
if ($_POST['ajax']) {
|
34
|
if (isset($_POST['service'])) {
|
35
|
$service_name = htmlspecialchars($_REQUEST['service']);
|
36
|
}
|
37
|
|
38
|
if (!empty($service_name)) {
|
39
|
switch ($_POST['mode']) {
|
40
|
case "restartservice":
|
41
|
$savemsg = service_control_restart($service_name, $_REQUEST);
|
42
|
break;
|
43
|
case "startservice":
|
44
|
$savemsg = service_control_start($service_name, $_REQUEST);
|
45
|
break;
|
46
|
case "stopservice":
|
47
|
$savemsg = service_control_stop($service_name, $_REQUEST);
|
48
|
break;
|
49
|
}
|
50
|
sleep(5);
|
51
|
}
|
52
|
|
53
|
exit;
|
54
|
}
|
55
|
|
56
|
$pgtitle = array(gettext("Status"), gettext("Services"));
|
57
|
include("head.inc");
|
58
|
|
59
|
if ($savemsg) {
|
60
|
print_info_box($savemsg, 'success');
|
61
|
}
|
62
|
|
63
|
$services = get_services();
|
64
|
|
65
|
// $debugsvcs = array('name' => 'captiveportal', 'description' => 'Captive Portal', 'zone' => '14');
|
66
|
// array_push($services, $debugsvcs);
|
67
|
|
68
|
if (count($services) > 0) {
|
69
|
?>
|
70
|
<form action="status_services.php" method="post">
|
71
|
<input id="mode" type="hidden" name="mode" value=""/>
|
72
|
<input id="vpnmode" type="hidden" name="vpnmode" value=""/>
|
73
|
<input id="service" type="hidden" name="service" value=""/>
|
74
|
<input id="id" type="hidden" name="id" value=""/>
|
75
|
<input id="zone" type="hidden" name="zone" value=""/>
|
76
|
|
77
|
<div class="panel panel-default">
|
78
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext('Services')?></h2></div>
|
79
|
<div class="panel-body">
|
80
|
|
81
|
<div class="panel-body panel-default">
|
82
|
<div class="table-responsive">
|
83
|
<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
|
84
|
<thead>
|
85
|
<tr>
|
86
|
<th><?=gettext("Service")?></th>
|
87
|
<th><?=gettext("Description")?></th>
|
88
|
<th><?=gettext("Status")?></th>
|
89
|
<th><?=gettext("Actions")?></th>
|
90
|
</tr>
|
91
|
</thead>
|
92
|
<tbody>
|
93
|
<?php
|
94
|
|
95
|
uasort($services, "service_name_compare");
|
96
|
|
97
|
foreach ($services as $service) {
|
98
|
if (empty($service['name'])) {
|
99
|
continue;
|
100
|
}
|
101
|
|
102
|
if (empty($service['description'])) {
|
103
|
$service['description'] = get_pkg_descr($service['name']);
|
104
|
}
|
105
|
?>
|
106
|
<tr>
|
107
|
<td>
|
108
|
<?=$service['name']?>
|
109
|
</td>
|
110
|
<td>
|
111
|
<?=$service['description']?>
|
112
|
</td>
|
113
|
<td>
|
114
|
<?= get_service_status_icon($service, false, true, false, "state"); ?>
|
115
|
</td>
|
116
|
<td>
|
117
|
<?=get_service_control_links($service)?>
|
118
|
|
119
|
<?php
|
120
|
$scut = get_shortcut_by_service_name($service['name']);
|
121
|
|
122
|
if (!empty($scut)) {
|
123
|
echo get_shortcut_main_link($scut, true, $service);
|
124
|
echo get_shortcut_status_link($scut, true, $service);
|
125
|
echo get_shortcut_log_link($scut, true);
|
126
|
}
|
127
|
?>
|
128
|
</td>
|
129
|
</tr>
|
130
|
<?php
|
131
|
}
|
132
|
?>
|
133
|
</tbody>
|
134
|
</table>
|
135
|
</div>
|
136
|
</div>
|
137
|
|
138
|
</div>
|
139
|
</div>
|
140
|
|
141
|
</form>
|
142
|
<?php
|
143
|
} else {
|
144
|
print_info_box(gettext("No services found."), 'danger');
|
145
|
}
|
146
|
|
147
|
include("foot.inc");
|