-
Notifications
You must be signed in to change notification settings - Fork 50
/
services.php
129 lines (98 loc) · 3.92 KB
/
services.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
$active_page = 'services';
include_once('./include/config.php');
$services = shell_exec('/usr/sbin/service --status-all');
$service_arr = preg_split("/\\r\\n|\\r|\\n/", $services);
$active_services_arr = array();
$inactive_services_arr = array();
foreach($service_arr AS $a)
{
if(stristr($a, '[ + ]'))
{
$a = str_replace("[ + ]", '', $a);
if(!empty($a))$active_services_arr[] = trim($a);
}
else
{
$a = str_replace("[ - ]", '', $a);
if(!empty($a))$inactive_services_arr[] = trim($a);
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="./static/images/raspberry.png" type="image/png" />
<link rel="icon" href="./static/images/raspberry.png" type="image/png" />
<title>GumCP Services</title>
<link href="./static/css.php" rel="stylesheet" type="text/css">
<script src="./static/js.php" type="text/javascript">
</script>
</head>
<body>
<div class="container">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="./index.php"><img src="./static/images/raspberry.png" />GumCP</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<?php
include_once('./include/menu.php');
?>
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container-fluid -->
</nav>
<div id="system-status" class="panel panel-default" style="margin-bottom: 5px">
<div class="panel-heading">
<h3 class="panel-title">Active System Services</h3>
</div>
<div class="panel-body">
<table class="table table-hover">
<?php
foreach($active_services_arr AS $a)
{
echo '<tr><td>'.$a.'</td><td><form method="post" action="./actions.php" style="display:inline-block;"><input type="hidden" name="sname" value="'.$a.'"><input type="hidden" class="form-control" name="action" value="stop_sname"><button type="submit" class="btn btn-xs btn-danger" onclick="return confirm(\'Are you sure to stop '.$a.'?\')">Stop</button></form></td></tr>';
}
?>
</table>
</div>
</div>
<div id="system-status" class="panel panel-default" style="margin-bottom: 5px">
<div class="panel-heading">
<h3 class="panel-title">Inactive System Services</h3>
</div>
<div class="panel-body">
<table class="table table-hover">
<?php
foreach($inactive_services_arr AS $a)
{
echo '<tr><td>'.$a.'</td><td><form method="post" action="./actions.php" style="display:inline-block;"><input type="hidden" name="sname" value="'.$a.'"><input type="hidden" class="form-control" name="action" value="start_sname"><button type="submit" class="btn btn-xs btn-success" onclick="return confirm(\'Are you sure to start '.$a.'?\')">Start</button></form></td></tr>';
}
?>
</table>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="text-muted">GumCP <a href="https://github.com/gumslone/GumCP">GitHub</a>. <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCWHQPACTXV5N"><img src="./static/images/Donate-PayPal-green.svg"/></a></p>
</div>
</footer>
<div id="dialog-placeholder"></div>
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
</body>
</html>