diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b1de77f6..c394dadf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,17 @@ +# v1.7.30 +## 02/07/2022 + +1. [](#new) + * Added twig filter `|field_parent` to get parent field name +2. [](#bugfix) + * Fixed error while deleting retina image in admin + * Fixed "Page Authors" field in Security tab, wrongly loading and saving the value [#3525](https://github.com/getgrav/grav/issues/3525) + * Fixed accounts filter only matches against email address [getgrav/grav-plugin-admin#2224](https://github.com/getgrav/grav-plugin-admin/issues/2224) + # v1.7.29.1 ## 01/31/2022 -3. [](#bugfix) +1. [](#bugfix) * Fixed `Call to undefined method` error when upgrading from Grav 1.6 [#3523](https://github.com/getgrav/grav/issues/3523) # v1.7.29 diff --git a/composer.json b/composer.json index 2c82dd72d..511690104 100644 --- a/composer.json +++ b/composer.json @@ -82,7 +82,8 @@ "ext-intl": "Recommended for multi-language sites", "ext-memcache": "Needed to support Memcache servers", "ext-memcached": "Needed to support Memcached servers", - "ext-redis": "Needed to support Redis servers" + "ext-redis": "Needed to support Redis servers", + "ext-exif": "Needed to use exif data from images." }, "config": { "apcu-autoloader": true, diff --git a/composer.lock b/composer.lock index ce9ff368c..215309419 100644 --- a/composer.lock +++ b/composer.lock @@ -764,12 +764,12 @@ } }, "autoload": { - "psr-4": { - "GuzzleHttp\\Psr7\\": "src/" - }, "files": [ "src/functions_include.php" - ] + ], + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1316,16 +1316,16 @@ }, { "name": "nyholm/psr7", - "version": "1.4.1", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/Nyholm/psr7.git", - "reference": "2212385b47153ea71b1c1b1374f8cb5e4f7892ec" + "reference": "1461e07a0f2a975a52082ca3b769ca912b816226" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Nyholm/psr7/zipball/2212385b47153ea71b1c1b1374f8cb5e4f7892ec", - "reference": "2212385b47153ea71b1c1b1374f8cb5e4f7892ec", + "url": "https://api.github.com/repos/Nyholm/psr7/zipball/1461e07a0f2a975a52082ca3b769ca912b816226", + "reference": "1461e07a0f2a975a52082ca3b769ca912b816226", "shasum": "" }, "require": { @@ -1377,7 +1377,7 @@ ], "support": { "issues": "https://github.com/Nyholm/psr7/issues", - "source": "https://github.com/Nyholm/psr7/tree/1.4.1" + "source": "https://github.com/Nyholm/psr7/tree/1.5.0" }, "funding": [ { @@ -1389,7 +1389,7 @@ "type": "github" } ], - "time": "2021-07-02T08:32:20+00:00" + "time": "2022-02-02T18:37:57+00:00" }, { "name": "nyholm/psr7-server", @@ -2654,12 +2654,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Iconv\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Iconv\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2814,12 +2814,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php74\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Php74\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2894,12 +2894,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -2977,12 +2977,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php81\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -3507,13 +3507,13 @@ "branch-alias": [] }, "autoload": { + "files": [ + "functions.php" + ], "psr-4": { "Codeception\\": "src/Codeception", "Codeception\\Extension\\": "ext" - }, - "files": [ - "functions.php" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -4214,12 +4214,12 @@ }, "type": "library", "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, "files": [ "src/DeepCopy/deep_copy.php" - ] + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -4641,16 +4641,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.4.3", + "version": "1.4.6", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "89d10839dbfc95eeb7da656578b4a899ad2b59b1" + "reference": "8a7761f1c520e0dad6e04d862fdc697445457cfe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/89d10839dbfc95eeb7da656578b4a899ad2b59b1", - "reference": "89d10839dbfc95eeb7da656578b4a899ad2b59b1", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/8a7761f1c520e0dad6e04d862fdc697445457cfe", + "reference": "8a7761f1c520e0dad6e04d862fdc697445457cfe", "shasum": "" }, "require": { @@ -4681,7 +4681,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.4.3" + "source": "https://github.com/phpstan/phpstan/tree/1.4.6" }, "funding": [ { @@ -4701,7 +4701,7 @@ "type": "tidelift" } ], - "time": "2022-01-28T16:27:17+00:00" + "time": "2022-02-06T12:56:13+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", diff --git a/system/blueprints/flex/user-accounts.yaml b/system/blueprints/flex/user-accounts.yaml index 384bf97c0..8d336f993 100644 --- a/system/blueprints/flex/user-accounts.yaml +++ b/system/blueprints/flex/user-accounts.yaml @@ -122,6 +122,8 @@ config: fields: - key - email + - username + - fullname blueprints: configure: diff --git a/system/blueprints/flex/user-groups.yaml b/system/blueprints/flex/user-groups.yaml index 05ba87b73..a5d348b5a 100644 --- a/system/blueprints/flex/user-groups.yaml +++ b/system/blueprints/flex/user-groups.yaml @@ -113,6 +113,7 @@ config: fields: - key - groupname + - readableName - description blueprints: diff --git a/system/blueprints/pages/partials/security.yaml b/system/blueprints/pages/partials/security.yaml index d7619b975..26d8c7dcb 100644 --- a/system/blueprints/pages/partials/security.yaml +++ b/system/blueprints/pages/partials/security.yaml @@ -51,17 +51,13 @@ form: type: bool header.permissions.authors: - type: list + type: array toggleable: true + value_only: true + placeholder_value: PLUGIN_ADMIN.USERNAME label: PLUGIN_ADMIN.PAGE_AUTHORS help: PLUGIN_ADMIN.PAGE_AUTHORS_HELP - fields: - value: - type: text - placeholder: PLUGIN_ADMIN.USERNAME - style: vertical - header.permissions.groups: ignore@: true type: acl_picker diff --git a/system/defines.php b/system/defines.php index 6520711f3..39dd69264 100644 --- a/system/defines.php +++ b/system/defines.php @@ -9,7 +9,7 @@ // Some standard defines define('GRAV', true); -define('GRAV_VERSION', '1.7.29.1'); +define('GRAV_VERSION', '1.7.30'); define('GRAV_SCHEMA', '1.7.0_2020-11-20_1'); define('GRAV_TESTING', false); diff --git a/system/src/Grav/Common/Media/Traits/MediaUploadTrait.php b/system/src/Grav/Common/Media/Traits/MediaUploadTrait.php index 2bddf9752..36a4503f1 100644 --- a/system/src/Grav/Common/Media/Traits/MediaUploadTrait.php +++ b/system/src/Grav/Common/Media/Traits/MediaUploadTrait.php @@ -573,6 +573,8 @@ protected function doRemove(string $filename, string $path): void } } } + + $this->hide($filename); } /** diff --git a/system/src/Grav/Common/Twig/Extension/FilesystemExtension.php b/system/src/Grav/Common/Twig/Extension/FilesystemExtension.php index 9b9085558..0ae793e62 100644 --- a/system/src/Grav/Common/Twig/Extension/FilesystemExtension.php +++ b/system/src/Grav/Common/Twig/Extension/FilesystemExtension.php @@ -266,24 +266,24 @@ public function getimagesize($filename) } /** - * @param string $file + * @param string $filename * @param string|null $required_sections * @param bool $as_arrays * @param bool $read_thumbnail * @return array|false */ - public function exif_read_data($file, ?string $required_sections, bool $as_arrays = false, bool $read_thumbnail = false) + public function exif_read_data($filename, ?string $required_sections, bool $as_arrays = false, bool $read_thumbnail = false) { - if (!Utils::functionExists('exif_read_data') || !$this->checkFilename($file)) { + if (!Utils::functionExists('exif_read_data') || !$this->checkFilename($filename)) { return false; } - return exif_read_data($file, $required_sections, $as_arrays, $read_thumbnail); + return exif_read_data($filename, $required_sections, $as_arrays, $read_thumbnail); } /** * @param string $filename - * @return string|false + * @return int|false */ public function exif_imagetype($filename) { @@ -311,18 +311,18 @@ public function hash_file(string $algo, string $filename, bool $binary = false) /** * @param string $algo - * @param string $data + * @param string $filename * @param string $key * @param bool $binary * @return string|false */ - public function hash_hmac_file(string $algo, string $data, string $key, bool $binary = false) + public function hash_hmac_file(string $algo, string $filename, string $key, bool $binary = false) { - if (!$this->checkFilename($data)) { + if (!$this->checkFilename($filename)) { return false; } - return hash_hmac_file($algo, $data, $key, $binary); + return hash_hmac_file($algo, $filename, $key, $binary); } /** diff --git a/system/src/Grav/Common/Twig/Extension/GravExtension.php b/system/src/Grav/Common/Twig/Extension/GravExtension.php index dcff83750..52e2a1841 100644 --- a/system/src/Grav/Common/Twig/Extension/GravExtension.php +++ b/system/src/Grav/Common/Twig/Extension/GravExtension.php @@ -116,6 +116,7 @@ public function getFilters(): array new TwigFilter('defined', [$this, 'definedDefaultFilter']), new TwigFilter('ends_with', [$this, 'endsWithFilter']), new TwigFilter('fieldName', [$this, 'fieldNameFilter']), + new TwigFilter('parent_field', [$this, 'fieldParentFilter']), new TwigFilter('ksort', [$this, 'ksortFilter']), new TwigFilter('ltrim', [$this, 'ltrimFilter']), new TwigFilter('markdown', [$this, 'markdownFunction'], ['needs_context' => true, 'is_safe' => ['html']]), @@ -260,6 +261,10 @@ public function getTokenParsers(): array ]; } + /** + * @param mixed $var + * @return string + */ public function print_r($var) { return print_r($var, true); @@ -278,6 +283,20 @@ public function fieldNameFilter($str) return array_shift($path) . ($path ? '[' . implode('][', $path) . ']' : ''); } + /** + * Filters field name by changing dot notation into array notation. + * + * @param string $str + * @return string + */ + public function fieldParentFilter($str) + { + $path = explode('.', rtrim($str, '.')); + array_pop($path); + + return implode('.', $path); + } + /** * Protects email address. *