Revert to stable version 3.5.4

This commit is contained in:
Hypolite Petovan 2018-02-11 19:00:01 -05:00
parent 38db18b624
commit 5360f08f42
355 changed files with 21449 additions and 4957 deletions

View file

@ -46,7 +46,7 @@ if($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
header('Access-Control-Allow-Headers: Content-Type');
header('Access-Control-Max-Age: 31536000');
exit;
}
@ -58,7 +58,7 @@ if($data) {
// CORS headers
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Content-Type');
$method = 'POST';
}
@ -76,7 +76,7 @@ else {
}
// HTTP headers
$headers = ['User-Agent: Jappix (BOSH PHP Proxy)', 'Connection: keep-alive', 'Content-Type: text/xml; charset=utf-8', 'Content-Length: '.strlen($data)];
$headers = array('User-Agent: Jappix (BOSH PHP Proxy)', 'Connection: keep-alive', 'Content-Type: text/xml; charset=utf-8', 'Content-Length: '.strlen($data));
// CURL is better if available
if(function_exists('curl_init'))
@ -91,7 +91,7 @@ $use_curl = false;
if($use_curl) {
// Initialize CURL
$connection = curl_init($HOST_BOSH);
// Set the CURL settings
curl_setopt($connection, CURLOPT_HEADER, 0);
curl_setopt($connection, CURLOPT_POST, 1);
@ -104,7 +104,7 @@ if($use_curl) {
curl_setopt($connection, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($connection, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($connection, CURLOPT_RETURNTRANSFER, 1);
// Get the CURL output
$output = curl_exec($connection);
}
@ -112,11 +112,11 @@ if($use_curl) {
// Built-in stream functions
else {
// HTTP parameters
$parameters = ['http' => [
$parameters = array('http' => array(
'method' => 'POST',
'content' => $data
]
];
)
);
$parameters['http']['header'] = $headers;
@ -148,7 +148,7 @@ header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
if($method == 'POST') {
// XML header
header('Content-Type: text/xml; charset=utf-8');
if(!$output)
echo('<body xmlns=\'http://jabber.org/protocol/httpbind\' type=\'terminate\'/>');
else
@ -159,10 +159,10 @@ if($method == 'POST') {
if($method == 'GET') {
// JSON header
header('Content-type: application/json');
// Encode output to JSON
$json_output = json_encode($output);
if(($output == false) || ($output == '') || ($json_output == 'null'))
echo($callback.'({"reply":"<body xmlns=\'http:\/\/jabber.org\/protocol\/httpbind\' type=\'terminate\'\/>"});');
else