merge master in prod

This commit is contained in:
2020-09-08 12:00:45 +02:00
parent b925edaa9e
commit 3e5e731c2c
226 changed files with 8516 additions and 4149 deletions
+4 -1
View File
@@ -1671,8 +1671,11 @@ class Admin
{
$reports = new ArrayCollection();
/** @var Pages $pages */
$pages = $this->grav['pages'];
// Default to XSS Security Report
$result = Security::detectXssFromPages($this->grav['pages'], true);
$result = Security::detectXssFromPages($pages, true);
$reports['Grav Security Check'] = $this->grav['twig']->processTemplate('reports/security.html.twig', [
'result' => $result,
@@ -325,7 +325,7 @@ class AdminBaseController
}
$isMime = strstr($type, '/');
$find = str_replace(['.', '*'], ['\.', '.*'], $type);
$find = str_replace(['.', '*', '+'], ['\.', '.*', '\+'], $type);
if ($isMime) {
$match = preg_match('#' . $find . '$#', $mime);
@@ -737,8 +737,8 @@ class AdminBaseController
// Process previously uploaded files for the current URI
// and finally store them. Everything else will get discarded
$queue = $this->admin->session()->getFlashObject('files-upload');
$queue = $queue[base64_encode($this->grav['uri']->url())];
if (is_array($queue)) {
$queue = $queue[base64_encode($this->grav['uri']->url())];
foreach ($queue as $key => $files) {
foreach ($files as $destination => $file) {
if (!rename($file['tmp_name'], $destination)) {
@@ -943,7 +943,7 @@ class AdminBaseController
$settings = (object)$blueprints->schema()->getProperty($field);
} else {
$page = null;
if ($type === 'themes') {
if ($type === 'themes' || $type === 'plugins') {
$obj = $this->grav[$type]->get(Utils::substrToString($blueprint, '/')); //here
$settings = (object) $obj->blueprints()->schema()->getProperty($field);
} else {
+15 -1
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;
}