mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-03 07:04:07 +01:00
* [MOD] Improved plugins manager
* [MOD] Code refactoring and cleanup * [MOD] Make classes final for performance improvements and avoid some side behaviours
This commit is contained in:
@@ -53,49 +53,6 @@ final class HttpUtil
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Devolver las cabeceras enviadas desde el cliente.
|
||||
*
|
||||
* @param string $header nombre de la cabecera a devolver
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
public static function getRequestHeaders($header = '')
|
||||
{
|
||||
if (!empty($header)) {
|
||||
$header = strpos($header, 'HTTP_') === false ? 'HTTP_' . str_replace('-', '_', strtoupper($header)) : $header;
|
||||
|
||||
return isset($_SERVER[$header]) ? $_SERVER[$header] : '';
|
||||
}
|
||||
|
||||
return self::getApacheHeaders();
|
||||
}
|
||||
|
||||
/**
|
||||
* Función que sustituye a apache_request_headers
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private static function getApacheHeaders()
|
||||
{
|
||||
if (function_exists('\apache_request_headers')) {
|
||||
return apache_request_headers();
|
||||
}
|
||||
|
||||
$headers = [];
|
||||
|
||||
foreach ($_SERVER as $key => $value) {
|
||||
if (strpos($key, 'HTTP_') === 0) {
|
||||
$key = ucwords(strtolower(str_replace('_', '-', substr($key, 5))), '-');
|
||||
$headers[$key] = $value;
|
||||
} else {
|
||||
$headers[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Comprobar si existen parámetros pasados por POST para enviarlos por GET
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user