Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/getgrav/grav into 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mahagr committed Nov 17, 2017
2 parents aa2341d + cb4147a commit ddd451b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
* Uri: Encode user and password to prevent issues in browsers
* Fixed "Invalid AJAX response" When using Built-in PHP Webserver in Windows [#1258](https://github.com/getgrav/grav-plugin-admin/issues/1258)
* Remove support for `config.user`, it was broken and bad practise
* Make sure that `clean cache` uses valid path [#1745](https://github.com/getgrav/grav/pull/1745)
* Fixed token creation issue with `Uri` params like `/id:3`

# v1.3.8
## 10/26/2017
Expand Down
1 change: 1 addition & 0 deletions system/src/Grav/Common/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ public static function clearCache($remove = 'standard')
// Convert stream to a real path
try {
$path = $locator->findResource($stream, true, true);
if($path === false) continue;

$anything = false;
$files = glob($path . '/*');
Expand Down
9 changes: 9 additions & 0 deletions system/src/Grav/Common/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -1143,11 +1143,20 @@ public static function convertUrlOld(Page $page, $markdown_url, $type = 'link',
*/
public static function addNonce($url, $action, $nonceParamName = 'nonce')
{
$fake = $url && $url[0] === '/';

if ($fake) {
$url = 'http://domain.com' . $url;
}
$uri = new static($url);
$parts = $uri->toArray();
$nonce = Utils::getNonce($action);
$parts['params'] = (isset($parts['params']) ? $parts['params'] : []) + [$nonceParamName => $nonce];

if ($fake) {
unset($parts['scheme'], $parts['host']);
}

return static::buildUrl($parts);
}

Expand Down

0 comments on commit ddd451b

Please sign in to comment.