Update message_send.php

This commit is contained in:
FusionPBX
2018-09-19 02:45:53 -04:00
committed by GitHub
parent 7727b04b09
commit e8ac98ce3f
+8 -7
View File
@@ -142,7 +142,7 @@
$message['message_date'] = 'now()'; $message['message_date'] = 'now()';
$message['message_from'] = $message_from; $message['message_from'] = $message_from;
$message['message_to'] = $message_to; $message['message_to'] = $message_to;
$message['$message_text'] = $message_text; $message['message_text'] = $message_text;
//prepare the array //prepare the array
$array['messages'][0] = $message; $array['messages'][0] = $message;
@@ -171,7 +171,7 @@
$http_method = $_SESSION['message']['http_method']['text']; $http_method = $_SESSION['message']['http_method']['text'];
$http_content_type = $_SESSION['message']['http_content_type']['text']; $http_content_type = $_SESSION['message']['http_content_type']['text'];
$http_destination = $_SESSION['message']['http_destination']['text']; $http_destination = $_SESSION['message']['http_destination']['text'];
$http_auth_enabled = $_SESSION['message']['http_auth_enabled']['text']; $http_auth_enabled = $_SESSION['message']['http_auth_enabled']['boolean'];
$http_auth_type = $_SESSION['message']['http_auth_type']['text']; $http_auth_type = $_SESSION['message']['http_auth_type']['text'];
$http_auth_user = $_SESSION['message']['http_auth_user']['text']; $http_auth_user = $_SESSION['message']['http_auth_user']['text'];
$http_auth_password = $_SESSION['message']['http_auth_password']['text']; $http_auth_password = $_SESSION['message']['http_auth_password']['text'];
@@ -180,17 +180,18 @@
$message_from = preg_replace('{[\D]}', '', $message_from); $message_from = preg_replace('{[\D]}', '', $message_from);
//exchange variable name with their values //exchange variable name with their values
$http_destination = str_replace("${from}", $message_from, $http_destination); $http_destination = str_replace("\${from}", $message_from, $http_destination);
//send the message to the provider //send the message to the provider
$headers[] = "Content-type: ".trim($http_content_type); $headers[] = "Content-type: ".trim($http_content_type);
if ($http_auth_enabled == 'true' && $http_auth_type == 'basic') { if ($http_auth_type == 'basic') {
$headers[] = "Authorization: Basic ".base64_encode($http_auth_username.':'.$http_auth_password); $headers[] = "Authorization: Basic ".base64_encode($http_auth_user.':'.$http_auth_password);
} }
$response = http_request($http_destination, $http_method, $headers, $http_content); $response = http_request($http_destination, $http_method, $headers, $http_content);
echo $response; //echo $response;
//redirect the user //redirect the user
$_SESSION["message"] = $text['message-sent']; //$_SESSION["message"] = $text['message-sent'];
header('Location: messages.php'); header('Location: messages.php');
return; return;
} //(is_array($_POST) && strlen($_POST["persistformvar"]) == 0) } //(is_array($_POST) && strlen($_POST["persistformvar"]) == 0)