Fixed the response when the result is an array
This commit is contained in:
parent
091dca3ceb
commit
f9bd89ef78
|
|
@ -402,23 +402,32 @@
|
||||||
|
|
||||||
//send the api command
|
//send the api command
|
||||||
if (!empty($command) && $event_socket->is_connected()) {
|
if (!empty($command) && $event_socket->is_connected()) {
|
||||||
$response_api[$registration['user']]['command'] = $event_socket->request('api ' . $command);
|
$response = $event_socket->request('api ' . $command);
|
||||||
$response_api[$registration['user']]['log'] = $event_socket->request("log notice $command");
|
$response_api[$user]['command'] = $command;
|
||||||
|
$response_api[$user]['log'] = $response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//set message
|
//set message
|
||||||
if (is_array($response_api)) {
|
if (is_array($response_api)) {
|
||||||
$message = $response_message;
|
|
||||||
foreach ($response_api as $registration_user => $response) {
|
foreach ($response_api as $registration_user => $response) {
|
||||||
if (trim($response['command']) != '-ERR no reply') {
|
if (is_array($response['command'])) {
|
||||||
$message .= "<br>\n<strong>".$registration_user."</strong>: ".$response['command'];
|
foreach($response['command'] as $command) {
|
||||||
|
$command = trim($command ?? '');
|
||||||
|
if ($command !== '-ERR no reply') {
|
||||||
|
$message .= "<br>\n<strong>".escape($registration_user)."</strong>: ".escape($response_message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!empty($response['command']) && $response['command'] !== '-ERR no reply') {
|
||||||
|
$message .= "<br>\n<strong>".escape($registration_user)."</strong>: ".escape($response_message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
message::add($message, 'positive', '7000');
|
message::add($message, 'positive', '7000');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
message::add($text['error-event-socket'], 'negative', 5000);
|
message::add($text['error-event-socket'], 'negative', 5000);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue