2016-12-25 11:03:37 +02:00
|
|
|
<?php
|
|
|
|
session_start();
|
|
|
|
$AuthUsers = array("admin");
|
|
|
|
if (!isset($_SESSION['mailcow_cc_role']) OR !in_array($_SESSION['mailcow_cc_role'], $AuthUsers)) {
|
|
|
|
echo "Not allowed." . PHP_EOL;
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
if ($_GET['ACTION'] == "start") {
|
2017-07-24 23:25:04 +02:00
|
|
|
$request = xmlrpc_encode_request("supervisor.startProcess", 'bootstrap-sogo', array('encoding'=>'utf-8'));
|
2016-12-25 11:03:37 +02:00
|
|
|
$context = stream_context_create(array('http' => array(
|
|
|
|
'method' => "POST",
|
|
|
|
'header' => "Content-Length: " . strlen($request),
|
|
|
|
'content' => $request
|
|
|
|
)));
|
|
|
|
$file = @file_get_contents("http://sogo:9191/RPC2", false, $context) or die("Cannot connect to $remote_server:$listener_port");
|
|
|
|
$response = xmlrpc_decode($file);
|
|
|
|
if (isset($response['faultString'])) {
|
|
|
|
echo '<b><span class="pull-right text-warning">' . $response['faultString'] . '</span></b>';
|
|
|
|
}
|
2017-06-19 10:30:11 +02:00
|
|
|
else {
|
|
|
|
echo '<b><span class="pull-right text-success">OK</span></b>';
|
|
|
|
}
|
2016-12-25 11:03:37 +02:00
|
|
|
}
|
|
|
|
elseif ($_GET['ACTION'] == "stop") {
|
2017-07-24 23:25:04 +02:00
|
|
|
$request = xmlrpc_encode_request("supervisor.stopProcess", 'bootstrap-sogo', array('encoding'=>'utf-8'));
|
2016-12-25 11:03:37 +02:00
|
|
|
$context = stream_context_create(array('http' => array(
|
|
|
|
'method' => "POST",
|
|
|
|
'header' => "Content-Length: " . strlen($request),
|
|
|
|
'content' => $request
|
|
|
|
)));
|
|
|
|
$file = @file_get_contents("http://sogo:9191/RPC2", false, $context) or die("Cannot connect to $remote_server:$listener_port");
|
|
|
|
$response = xmlrpc_decode($file);
|
|
|
|
if (isset($response['faultString'])) {
|
|
|
|
echo '<b><span class="pull-right text-warning">' . $response['faultString'] . '</span></b>';
|
|
|
|
}
|
|
|
|
else {
|
2017-02-23 21:15:27 +02:00
|
|
|
echo '<b><span class="pull-right text-success">OK</span></b>';
|
2016-12-25 11:03:37 +02:00
|
|
|
}
|
|
|
|
}
|
2017-07-24 23:25:04 +02:00
|
|
|
?>
|