Merge branch 'release/1.9.16'

This commit is contained in:
Andy Miller
2020-09-01 14:32:04 -06:00
4 changed files with 24 additions and 3 deletions

View File

@@ -1,3 +1,10 @@
# v1.9.16
## 09/01/2020
1. [](#bugfix)
* Fixed a glitch which allows user to delete entire pages directory [#1941](https://github.com/getgrav/grav-plugin-admin/issues/1941)
* Fixed the hidden login plugin toggle
# v1.9.15
## 06/08/2020

View File

@@ -1,7 +1,7 @@
name: Admin Panel
slug: admin
type: plugin
version: 1.9.15
version: 1.9.16
testing: false
description: Adds an advanced administration panel to manage your site
icon: empire

View File

@@ -487,6 +487,11 @@ class AdminController extends AdminBaseController
$data = (array)$this->data;
$folder = $data['folder'] ?? '';
if ($folder === '' || mb_strpos($folder, '/') !== false) {
throw new \RuntimeException('Creating folder failed, bad folder name', 400);
}
if ($data['route'] === '/') {
$path = $this->grav['locator']->findResource('page://');
} else {
@@ -494,7 +499,7 @@ class AdminController extends AdminBaseController
}
$orderOfNewFolder = static::getNextOrderInFolder($path);
$new_path = $path . '/' . $orderOfNewFolder . '.' . $data['folder'];
$new_path = $path . '/' . $orderOfNewFolder . '.' . $folder;
Folder::create($new_path);
Cache::clearCache('invalidate');
@@ -585,6 +590,11 @@ class AdminController extends AdminBaseController
/** @var PageInterface $obj */
$obj = $this->admin->page(true);
$folder = $data['folder'] ?? null;
if ($folder === '' || mb_strpos($folder, '/') !== false) {
throw new \RuntimeException('Saving page failed: bad folder name', 400);
}
if (!isset($data['folder']) || !$data['folder']) {
$data['folder'] = $obj->slug();
$this->data['folder'] = $obj->slug();
@@ -814,6 +824,10 @@ class AdminController extends AdminBaseController
$folder = \Grav\Plugin\Admin\Utils::slug($data[substr($folder, 9)]);
}
$folder = ltrim($folder, '_');
if ($folder === '' || mb_strpos($folder, '/') !== false) {
throw new \RuntimeException('Creating page failed: bad folder name', 400);
}
if (!empty($data['modular'])) {
$folder = '_' . $folder;
}

View File

@@ -42,7 +42,7 @@
{% if isTestingRelease %}<span class="gpm-testing">test release</span>{% endif %}
</td>
<td class="gpm-actions">
{% if (not installing and (plugin.form.fields.enabled.type != 'hidden' and plugin.form.fields.tabs.fields.login.fields.enabled.type != 'hidden')) %}
{% if (not installing and (plugin.form.fields.enabled.type != 'hidden' and plugin.form.fields.tabs.fields.options.fields.enabled.type != 'hidden')) %}
<a class="{{ data.get('enabled') ? 'enabled' : 'disabled' }}" href="{{ uri.addNonce(base_url_relative ~ '/plugins/' ~ slug ~ '/task' ~ config.system.param_sep ~ (data.get('enabled') ? 'disable' : 'enable'), 'admin-form', 'admin-nonce') }}">
<i class="fa fa-fw fa-toggle-{{ data.get('enabled') ? 'on' : 'off' }}"></i>
</a>