mirror of
https://github.com/getgrav/grav.git
synced 2026-02-04 13:50:13 +01:00
Merge remote-tracking branch 'origin/1.7' into 1.7
# Conflicts: # CHANGELOG.md
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
# v1.7.0-rc.17
|
||||
## mm/dd/2020
|
||||
|
||||
1. [](#new)
|
||||
* Added a `getAllHeaders()` compatibility function
|
||||
1. [](#improved)
|
||||
* Fall back through various templates scenarios if they don't exist in theme to avoid unhelpful error.
|
||||
* Added default templates for `external.html.twig`, `default.html.twig`, and `modular.html.twig`
|
||||
@@ -16,6 +18,7 @@
|
||||
* Fixed `FlexObject::freeMedia()` method causing media to become null
|
||||
* Fixed bug in `Flex Form` making it impossible to set nested values
|
||||
* Fixed `Flex User` avatar when using folder storage, also allow multiple images
|
||||
* Fixed Referer reference during GPM calls.
|
||||
* Fixed fatal error with toggled lists
|
||||
|
||||
# v1.7.0-rc.16
|
||||
|
||||
@@ -30,7 +30,6 @@ class Response
|
||||
public static $callback = null;
|
||||
|
||||
private static $headers = [
|
||||
'Referer' => 'Grav CMS',
|
||||
'User-Agent' => 'Grav CMS'
|
||||
];
|
||||
|
||||
@@ -58,10 +57,11 @@ class Response
|
||||
}
|
||||
|
||||
$config = Grav::instance()['config'];
|
||||
$referer = Grav::instance()['uri']->rootUrl(true);
|
||||
$options = new HttpOptions();
|
||||
|
||||
// Set default Headers
|
||||
$options->setHeaders(self::$headers);
|
||||
$options->setHeaders(array_merge([ 'Referer' => $referer ], self::$headers));
|
||||
|
||||
// Disable verify Peer if required
|
||||
$verify_peer = $config->get('system.gpm.verify_peer', true);
|
||||
|
||||
@@ -1436,6 +1436,24 @@ class Uri
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compatibility in case getallheaders() is not available on platform
|
||||
*/
|
||||
public static function getAllHeaders()
|
||||
{
|
||||
if (!function_exists('getallheaders')) {
|
||||
$headers = [];
|
||||
foreach ($_SERVER as $name => $value) {
|
||||
if (substr($name, 0, 5) == 'HTTP_') {
|
||||
$headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
|
||||
}
|
||||
}
|
||||
return $headers;
|
||||
}
|
||||
return getallheaders();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base URI with port if needed
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user