add function apache_request_headers() in case it is missing

this allows to run the web dav server even on non apache environments
or fastcgi is used
This commit is contained in:
Uwe Steinmann 2017-01-12 11:00:14 +01:00
parent 229ae54234
commit 7a7976827a

View File

@ -6,6 +6,31 @@ if(!empty($settings->_coreDir))
else
require_once('SeedDMS/Core.php');
/* Set apache_request_headers() in case it doesn't exists, like
* when using fastcgi (patch by christopher täufert)
*/
if( !function_exists('apache_request_headers') ) {
function apache_request_headers() {
$arh = array();
$rx_http = '/\AHTTP_/';
foreach($_SERVER as $key => $val) {
if( preg_match($rx_http, $key) ) {
$arh_key = preg_replace($rx_http, '', $key);
$rx_matches = array();
// do some nasty string manipulations to restore the original letter case
// this should work in most cases
$rx_matches = explode('_', $arh_key);
if( count($rx_matches) > 0 and strlen($arh_key) > 2 ) {
foreach($rx_matches as $ak_key => $ak_val) $rx_matches[$ak_key] = ucfirst($ak_val);
$arh_key = implode('-', $rx_matches);
}
$arh[$arh_key] = $val;
}
}
return( $arh );
}
}
/**
* SeedDMS access using WebDAV
*