mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-02 11:26:04 +01:00
Merge branch 'develop' of https://github.com/getgrav/grav-plugin-admin into 1.9
# Conflicts: # CHANGELOG.md # classes/adminbasecontroller.php # themes/grav/js/admin.min.js
This commit is contained in:
10
CHANGELOG.md
10
CHANGELOG.md
@@ -5,6 +5,7 @@
|
||||
* Unset state from user if not super or user admin
|
||||
* Make new System Config layout responsive [#1579](https://github.com/getgrav/grav-plugin-admin/issues/1579)
|
||||
* Take admin setting for 2FA into account when showing user 2FA badge [#1568](https://github.com/getgrav/grav-plugin-admin/issues/1568)
|
||||
* v.1.8.16 fixes merged in
|
||||
1. [](#bugfix)
|
||||
* Removed `tabs`, `tab`, and `toggle` fields as they are now in Form plugin
|
||||
|
||||
@@ -68,6 +69,13 @@
|
||||
* New `Backups` configuration panel in tools
|
||||
* New `Cache::purge()` option in cache drop-down to clear out old cache only
|
||||
|
||||
# v1.8.16
|
||||
## mm/dd/2019
|
||||
|
||||
1. [](#bugfix)
|
||||
* Fixed calendar js module not properly loading for datetime field [#1581](https://github.com/getgrav/grav-plugin-admin/issues/1581)
|
||||
* Fixed deleting file when using file field type [#1558](https://github.com/getgrav/grav-plugin-admin/issues/1558)
|
||||
|
||||
# v1.8.15
|
||||
## 12/14/2018
|
||||
|
||||
@@ -107,7 +115,7 @@
|
||||
1. [](#improved)
|
||||
* Change usage of basename where possible [#1480](https://github.com/getgrav/grav-plugin-admin/pull/1480)
|
||||
* Improved filename validation (requires Grav 1.5.3)
|
||||
* Updated various lang strings
|
||||
* Updated various lang codes
|
||||
1. [](#bugfix)
|
||||
* File Uploads: Do not trust mimetype sent by the browser
|
||||
* Fixed file extension detection
|
||||
|
||||
@@ -1403,9 +1403,9 @@ class Admin
|
||||
return $found_fields;
|
||||
}
|
||||
|
||||
public function getPagePathFromToken($path)
|
||||
public function getPagePathFromToken($path, $page = null)
|
||||
{
|
||||
return Utils::getPagePathFromToken($path, $this->page(true));
|
||||
return Utils::getPagePathFromToken($path, $page ?: $this->page(true));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,6 +6,7 @@ use Grav\Common\Filesystem\Folder;
|
||||
use Grav\Common\Grav;
|
||||
use Grav\Common\Media\Interfaces\MediaInterface;
|
||||
use Grav\Common\Page\Media;
|
||||
use Grav\Common\Uri;
|
||||
use Grav\Common\Utils;
|
||||
use Grav\Common\Plugin;
|
||||
use Grav\Common\Theme;
|
||||
@@ -902,22 +903,40 @@ class AdminBaseController
|
||||
*/
|
||||
protected function taskRemoveFileFromBlueprint()
|
||||
{
|
||||
/** @var Uri $uri */
|
||||
$uri = $this->grav['uri'];
|
||||
$blueprint = base64_decode($uri->param('blueprint'));
|
||||
$path = base64_decode($uri->param('path'));
|
||||
$filename = basename(isset($this->post['filename']) ? $this->post['filename'] : $path);
|
||||
$proute = base64_decode($uri->param('proute'));
|
||||
$type = $uri->param('type');
|
||||
$field = $uri->param('field');
|
||||
|
||||
// Get Blueprint
|
||||
if ($type === 'pages' || strpos($blueprint, 'pages/') === 0) {
|
||||
$page = $this->admin->page(true, $proute);
|
||||
if (!$page) {
|
||||
$this->admin->json_response = [
|
||||
'status' => 'error',
|
||||
'message' => 'Page not found'
|
||||
];
|
||||
|
||||
return false;
|
||||
}
|
||||
$blueprints = $page->blueprints();
|
||||
$path = Folder::getRelativePath($page->path());
|
||||
$settings = (object)$blueprints->schema()->getProperty($field);
|
||||
} else {
|
||||
$page = null;
|
||||
$settings = (object)$this->admin->blueprints($blueprint)->schema()->getProperty($field);
|
||||
}
|
||||
|
||||
// Get destination
|
||||
if ($this->grav['locator']->isStream($settings->destination)) {
|
||||
$destination = $this->grav['locator']->findResource($settings->destination, false, true);
|
||||
} else {
|
||||
$destination = Folder::getRelativePath(rtrim($settings->destination, '/'));
|
||||
$destination = $this->admin->getPagePathFromToken($destination);
|
||||
$destination = $this->admin->getPagePathFromToken($destination, $page);
|
||||
}
|
||||
|
||||
// Not in path
|
||||
@@ -931,10 +950,9 @@ class AdminBaseController
|
||||
}
|
||||
|
||||
// Only remove files from correct destination...
|
||||
$this->taskRemoveMedia($destination . '/' . basename($path));
|
||||
$this->taskRemoveMedia($destination . '/' . $filename);
|
||||
|
||||
if ($type === 'pages') {
|
||||
$page = $this->admin->page(true, $proute);
|
||||
if ($page) {
|
||||
$keys = explode('.', preg_replace('/^header./', '', $field));
|
||||
$header = (array)$page->header();
|
||||
$data_path = implode('.', $keys);
|
||||
|
||||
Reference in New Issue
Block a user