1 |
a0e4cea2
|
Scott Ullrich
|
<?php
|
2 |
|
|
/*
|
3 |
c5d81585
|
Renato Botelho
|
* status_services.php
|
4 |
|
|
*
|
5 |
|
|
* part of pfSense (https://www.pfsense.org)
|
6 |
b8f91b7c
|
Luiz Souza
|
* Copyright (c) 2004-2018 Rubicon Communications, LLC (Netgate)
|
7 |
c5d81585
|
Renato Botelho
|
* All rights reserved.
|
8 |
|
|
*
|
9 |
b12ea3fb
|
Renato Botelho
|
* 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 |
c5d81585
|
Renato Botelho
|
*
|
13 |
b12ea3fb
|
Renato Botelho
|
* http://www.apache.org/licenses/LICENSE-2.0
|
14 |
c5d81585
|
Renato Botelho
|
*
|
15 |
b12ea3fb
|
Renato Botelho
|
* 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 |
74b0f23e
|
Stephen Beaver
|
*/
|
21 |
a0e4cea2
|
Scott Ullrich
|
|
22 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
23 |
|
|
##|*IDENT=page-status-services
|
24 |
5230f468
|
jim-p
|
##|*NAME=Status: Services
|
25 |
6b07c15a
|
Matthew Grooms
|
##|*DESCR=Allow access to the 'Status: Services' page.
|
26 |
|
|
##|*MATCH=status_services.php*
|
27 |
|
|
##|-PRIV
|
28 |
|
|
|
29 |
e3c88b77
|
Ermal
|
require_once("guiconfig.inc");
|
30 |
44173def
|
Ermal Lu?i
|
require_once("service-utils.inc");
|
31 |
a517a108
|
jmkizer
|
require_once("shortcuts.inc");
|
32 |
a0e4cea2
|
Scott Ullrich
|
|
33 |
c7027903
|
Steve Beaver
|
if ($_POST['ajax']) {
|
34 |
|
|
if (isset($_POST['service'])) {
|
35 |
29fda3d3
|
Stephen Beaver
|
$service_name = htmlspecialchars($_REQUEST['service']);
|
36 |
8b88ac79
|
jim-p
|
}
|
37 |
517d3109
|
sbeaver
|
|
38 |
29fda3d3
|
Stephen Beaver
|
if (!empty($service_name)) {
|
39 |
c7027903
|
Steve Beaver
|
switch ($_POST['mode']) {
|
40 |
29fda3d3
|
Stephen Beaver
|
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 |
74b0f23e
|
Stephen Beaver
|
|
53 |
246a887a
|
Ermal
|
exit;
|
54 |
42b0c921
|
Phil Davis
|
}
|
55 |
b9eadc0c
|
Colin Smith
|
|
56 |
6c07db48
|
Phil Davis
|
$pgtitle = array(gettext("Status"), gettext("Services"));
|
57 |
4df96eff
|
Scott Ullrich
|
include("head.inc");
|
58 |
|
|
|
59 |
abe98adb
|
Phil Davis
|
if ($savemsg) {
|
60 |
517d3109
|
sbeaver
|
print_info_box($savemsg, 'success');
|
61 |
abe98adb
|
Phil Davis
|
}
|
62 |
a0e4cea2
|
Scott Ullrich
|
|
63 |
517d3109
|
sbeaver
|
$services = get_services();
|
64 |
|
|
|
65 |
74b0f23e
|
Stephen Beaver
|
// $debugsvcs = array('name' => 'captiveportal', 'description' => 'Captive Portal', 'zone' => '14');
|
66 |
|
|
// array_push($services, $debugsvcs);
|
67 |
|
|
|
68 |
517d3109
|
sbeaver
|
if (count($services) > 0) {
|
69 |
a0e4cea2
|
Scott Ullrich
|
?>
|
70 |
|
|
<form action="status_services.php" method="post">
|
71 |
74b0f23e
|
Stephen Beaver
|
<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 |
ac950976
|
Colin Fleming
|
<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 |
517d3109
|
sbeaver
|
<div class="panel-body panel-default">
|
82 |
|
|
<div class="table-responsive">
|
83 |
10fe1eb5
|
Stephen Beaver
|
<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
|
84 |
517d3109
|
sbeaver
|
<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 |
a0e4cea2
|
Scott Ullrich
|
<?php
|
94 |
|
|
|
95 |
b2254c7f
|
jim-p
|
uasort($services, "service_name_compare");
|
96 |
517d3109
|
sbeaver
|
|
97 |
ab7e04c7
|
Colin Fleming
|
foreach ($services as $service) {
|
98 |
|
|
if (empty($service['name'])) {
|
99 |
246a887a
|
Ermal
|
continue;
|
100 |
ab7e04c7
|
Colin Fleming
|
}
|
101 |
517d3109
|
sbeaver
|
|
102 |
74b0f23e
|
Stephen Beaver
|
if (empty($service['description'])) {
|
103 |
246a887a
|
Ermal
|
$service['description'] = get_pkg_descr($service['name']);
|
104 |
74b0f23e
|
Stephen Beaver
|
}
|
105 |
517d3109
|
sbeaver
|
?>
|
106 |
|
|
<tr>
|
107 |
|
|
<td>
|
108 |
|
|
<?=$service['name']?>
|
109 |
|
|
</td>
|
110 |
|
|
<td>
|
111 |
|
|
<?=$service['description']?>
|
112 |
|
|
</td>
|
113 |
|
|
<td>
|
114 |
0adf0d88
|
NOYB
|
<?= get_service_status_icon($service, false, true, false, "state"); ?>
|
115 |
517d3109
|
sbeaver
|
</td>
|
116 |
|
|
<td>
|
117 |
|
|
<?=get_service_control_links($service)?>
|
118 |
|
|
|
119 |
|
|
<?php
|
120 |
391abfcf
|
jim-p
|
$scut = get_shortcut_by_service_name($service['name']);
|
121 |
517d3109
|
sbeaver
|
|
122 |
391abfcf
|
jim-p
|
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 |
517d3109
|
sbeaver
|
?>
|
128 |
|
|
</td>
|
129 |
|
|
</tr>
|
130 |
|
|
<?php
|
131 |
a0e4cea2
|
Scott Ullrich
|
}
|
132 |
517d3109
|
sbeaver
|
?>
|
133 |
|
|
</tbody>
|
134 |
|
|
</table>
|
135 |
|
|
</div>
|
136 |
|
|
</div>
|
137 |
ac950976
|
Colin Fleming
|
|
138 |
|
|
</div>
|
139 |
|
|
</div>
|
140 |
|
|
|
141 |
517d3109
|
sbeaver
|
</form>
|
142 |
|
|
<?php
|
143 |
b9eadc0c
|
Colin Smith
|
} else {
|
144 |
8545adde
|
k-paulius
|
print_info_box(gettext("No services found."), 'danger');
|
145 |
b9eadc0c
|
Colin Smith
|
}
|
146 |
74b0f23e
|
Stephen Beaver
|
|
147 |
|
|
include("foot.inc");
|