Projet

Général

Profil

Télécharger (3,95 ko) Statistiques
| Branche: | Tag: | Révision:

univnautes / usr / local / www / status_services.php @ 4cc34245

1
<?php
2
/*
3
    services_status.php
4
    Copyright (C) 2004, 2005 Scott Ullrich
5
    All rights reserved.
6

    
7
    Redistribution and use in source and binary forms, with or without
8
    modification, are permitted provided that the following conditions are met:
9

    
10
    1. Redistributions of source code must retain the above copyright notice,
11
       this list of conditions and the following disclaimer.
12

    
13
    2. Redistributions in binary form must reproduce the above copyright
14
       notice, this list of conditions and the following disclaimer in the
15
       documentation and/or other materials provided with the distribution.
16

    
17
    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18
    INClUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
19
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
20
    AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
21
    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
    POSSIBILITY OF SUCH DAMAGE.
27
*/
28
/*	
29
	pfSense_BUILDER_BINARIES:	/usr/local/sbin/openvpn	/usr/bin/killall	/bin/ps
30
	pfSense_MODULE:	services
31
*/
32

    
33
##|+PRIV
34
##|*IDENT=page-status-services
35
##|*NAME=Status: Services page
36
##|*DESCR=Allow access to the 'Status: Services' page.
37
##|*MATCH=status_services.php*
38
##|-PRIV
39

    
40
require_once("guiconfig.inc");
41
require_once("service-utils.inc");
42
require_once("shortcuts.inc");
43

    
44
$service_name = '';
45
if (isset($_GET['service']))
46
	$service_name = htmlspecialchars($_GET['service']);
47

    
48
if (!empty($service_name)) {
49
	switch ($_GET['mode']) {
50
		case "restartservice":
51
			$savemsg = service_control_restart($service_name, $_GET);
52
			break;
53
		case "startservice":
54
			$savemsg = service_control_start($service_name, $_GET);
55
			break;
56
		case "stopservice":
57
			$savemsg = service_control_stop($service_name, $_GET);
58
			break;
59
	}
60
	sleep(5);
61
}
62

    
63
/* batch mode, allow other scripts to call this script */
64
if($_GET['batch'])
65
	exit;
66

    
67
$pgtitle = array(gettext("Status"),gettext("Services"));
68
include("head.inc");
69

    
70
?>
71

    
72
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
73
<?php
74
include("fbegin.inc");
75
?>
76
<form action="status_services.php" method="post">
77
<?php if ($savemsg) print_info_box($savemsg); ?>
78

    
79
<div id="boxarea">
80
<table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="status services">
81
	<thead>
82
	<tr>
83
		<td class="listhdrr" align="center"><?=gettext("Service");?></td>
84
		<td class="listhdrr" align="center"><?=gettext("Description");?></td>
85
		<td class="listhdrr" align="center"><?=gettext("Status");?></td>
86
	</tr>
87
	</thead>
88
	<tbody>
89
<?php
90

    
91
$services = get_services();
92

    
93
if (count($services) > 0) {
94
	uasort($services, "service_name_compare");
95
	foreach($services as $service) {
96
		if (empty($service['name']))
97
			continue;
98
		if (empty($service['description']))
99
			$service['description'] = get_pkg_descr($service['name']);
100
		echo '<tr><td class="listlr" width="20%">' . $service['name'] . '</td>' . "\n";
101
		echo '<td class="listr" width="55%">' . $service['description'] . '</td>' . "\n";
102
		echo '<td class="listr" align="center">' . "\n";
103
		echo get_service_status_icon($service, true, true);
104
		echo "</td>\n";
105
		echo '<td valign="middle" class="list nowrap">';
106
		echo get_service_control_links($service);
107
		$scut = get_shortcut_by_service_name($service['name']);
108
		if (!empty($scut)) {
109
			echo get_shortcut_main_link($scut, true, $service);
110
			echo get_shortcut_status_link($scut, true, $service);
111
			echo get_shortcut_log_link($scut, true);
112
		}
113
		echo "</td></tr>\n";
114
	}
115
} else {
116
	echo "<tr><td colspan=\"3\" align=\"center\">" . gettext("No services found") . ".</td></tr>\n";
117
}
118

    
119
?>
120
</tbody>
121
</table>
122
</div>
123
</form>
124
<?php include("fend.inc"); ?>
125
</body>
126
</html>
(192-192/246)