Update cmd.php

Add Applied response message and fix the referrer.
This commit is contained in:
FusionPBX
2016-06-24 10:13:25 -06:00
committed by GitHub
parent 82820c3d75
commit a67ba8fff3
+13 -3
View File
@@ -51,13 +51,13 @@ else {
//create the event socket connection //create the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) { if ($fp) {
//prepare the command //prepare the command
if ($cmd == "unregister") { if ($cmd == "unregister") {
$command = "sofia profile ".$profile." flush_inbound_reg ".$user." reboot"; $command = "sofia profile ".$profile." flush_inbound_reg ".$user." reboot";
} }
else { else {
$command = "lua app.lua event_notify ".$profile." ".$cmd." ".$user." ".$vendor; $command = "lua app.lua event_notify ".$profile." ".$cmd." ".$user." ".$vendor;
//if ($cmd == "check_sync") { //if ($cmd == "check_sync") {
// $command = "sofia profile ".$profile." check_sync ".$user; // $command = "sofia profile ".$profile." check_sync ".$user;
//} //}
@@ -65,8 +65,10 @@ else {
//send the command //send the command
$response = event_socket_request($fp, "api ".$command); $response = event_socket_request($fp, "api ".$command);
$response = event_socket_request($fp, "api log notice ".$command); $response = event_socket_request($fp, "api log notice ".$command);
//show the response //show the response
$_SESSION['message'] = $text['label-event']." ".ucwords($cmd)."     ".$text['label-response'].$response; $_SESSION['message'] = $text['label-event']." ".ucwords($cmd)."     ".$text['label-response'].$response;
//close the connection //close the connection
fclose($fp); fclose($fp);
} }
@@ -77,7 +79,15 @@ else {
echo $response; echo $response;
} }
else { else {
header("Location: status_registrations.php?profile=".$profile."&show=".$show); //send the message
$_SESSION["message_delay"] = 3500;
$_SESSION["message_mood"] = 'positive';
$_SESSION["message"] = $text['button-applied'];
//send the redirect
if (isset($_SERVER['HTTP_REFERER'])) {
header("Location: ".$_SERVER['HTTP_REFERER']);
}
} }
?> ?>