1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-03 17:59:21 +02:00

Declare apache_request_headers and getallheaders if missing (#212)

This commit is contained in:
Afterster 2014-05-28 00:44:13 +02:00
parent 69015e02ea
commit 9d8f57d16d

View file

@ -316,3 +316,27 @@ function escape_ini($str)
{
return str_replace('"', '\"', $str);
}
// Declare apache_request_headers and getallheaders if it don't exists (PHP <= 5.3 + FastCGI)
if (!function_exists('apache_request_headers')) {
function apache_request_headers()
{
$headers = array();
foreach ($_SERVER as $name => $value) {
if (substr($name, 0, 5) == 'HTTP_') {
$name = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))));
$headers[$name] = $value;
} else if ($name == "CONTENT_TYPE") {
$headers["Content-Type"] = $value;
} else if ($name == "CONTENT_LENGTH") {
$headers["Content-Length"] = $value;
}
}
return $headers;
}
function getallheaders()
{
return apache_request_headers();
}
}