Upgrade to 3.2.3

This commit is contained in:
Bastian Allgeier
2019-08-06 10:24:12 +02:00
parent 40f095f5de
commit 02be32bb75
48 changed files with 356 additions and 114 deletions

View File

@@ -35,7 +35,7 @@ return [
'requirements' => function (System $system) {
return $system->toArray();
},
'breadcrumbTitle' => function () {
'site' => function () {
try {
return $this->site()->blueprint()->title();
} catch (Throwable $e) {
@@ -90,7 +90,6 @@ return [
],
'panel' => [
'ascii',
'breadcrumbTitle',
'isOk',
'isInstalled',
'isLocal',
@@ -99,6 +98,7 @@ return [
'license',
'multilang',
'requirements',
'site',
'slugs',
'title',
'translation',

View File

@@ -35,25 +35,13 @@ return [
$long = $this->requestBody('long');
$password = $this->requestBody('password');
try {
if ($user = $this->kirby()->auth()->login($email, $password, $long)) {
return [
'code' => 200,
'status' => 'ok',
'user' => $this->resolve($user)->view('auth')->toArray()
];
}
$user = $this->kirby()->auth()->login($email, $password, $long);
throw new NotFoundException(['key' => 'user.undefined']);
} catch (Throwable $e) {
if ($this->kirby()->option('debug') === true) {
throw $e;
} else {
// catch any kind of login error
}
}
throw new InvalidArgumentException('Invalid email or password');
return [
'code' => 200,
'status' => 'ok',
'user' => $this->resolve($user)->view('auth')->toArray()
];
}
],
[

View File

@@ -1,37 +1,70 @@
<?php
use Kirby\Exception\Exception;
/**
* Content Lock Routes
*/
return [
[
'pattern' => '(:all)/lock',
'method' => 'GET',
'action' => function (string $path) {
return $this->parent($path)->lock()->get();
if ($lock = $this->parent($path)->lock()) {
return [
'supported' => true,
'locked' => $lock->get()
];
}
return [
'supported' => false,
'locked' => null
];
}
],
[
'pattern' => '(:all)/lock',
'method' => 'PATCH',
'action' => function (string $path) {
return $this->parent($path)->lock()->create();
if ($lock = $this->parent($path)->lock()) {
return $lock->create();
}
throw new Exception([
'key' => 'lock.notImplemented',
'httpCode' => 501
]);
}
],
[
'pattern' => '(:all)/lock',
'method' => 'DELETE',
'action' => function (string $path) {
return $this->parent($path)->lock()->remove();
if ($lock = $this->parent($path)->lock()) {
return $lock->remove();
}
throw new Exception([
'key' => 'lock.notImplemented',
'httpCode' => 501
]);
}
],
[
'pattern' => '(:all)/unlock',
'method' => 'GET',
'action' => function (string $path) {
if ($lock = $this->parent($path)->lock()) {
return [
'supported' => true,
'unlocked' => $lock->isUnlocked()
];
}
return [
'isUnlocked' => $this->parent($path)->lock()->isUnlocked()
'supported' => false,
'unlocked' => null
];
}
],
@@ -39,14 +72,28 @@ return [
'pattern' => '(:all)/unlock',
'method' => 'PATCH',
'action' => function (string $path) {
return $this->parent($path)->lock()->unlock();
if ($lock = $this->parent($path)->lock()) {
return $lock->unlock();
}
throw new Exception([
'key' => 'lock.notImplemented',
'httpCode' => 501
]);
}
],
[
'pattern' => '(:all)/unlock',
'method' => 'DELETE',
'action' => function (string $path) {
return $this->parent($path)->lock()->resolve();
if ($lock = $this->parent($path)->lock()) {
return $lock->resolve();
}
throw new Exception([
'key' => 'lock.notImplemented',
'httpCode' => 501
]);
}
],
];

View File

@@ -82,7 +82,7 @@ return [
$files = $this->parent->files()->template($this->template);
if ($this->sortBy) {
$files = $files->sortBy(...Str::split($this->sortBy, ' '));
$files = $files->sortBy(...$files::sortArgs($this->sortBy));
} elseif ($this->sortable === true) {
$files = $files->sortBy('sort', 'asc');
}

View File

@@ -122,7 +122,7 @@ return [
// sort
if ($this->sortBy) {
$pages = $pages->sortBy(...Str::split($this->sortBy, ' '));
$pages = $pages->sortBy(...$pages::sortArgs($this->sortBy));
}
// pagination

View File

@@ -106,7 +106,7 @@ return [
if (empty($tag->link) === true) {
return $img;
}
if ($link = $tag->file($tag->link)) {
$link = $link->url();
} else {
@@ -227,13 +227,15 @@ return [
'html' => function ($tag) {
$video = Html::video(
$tag->value,
$tag->kirby()->option('kirbytext.video.options', [])
$tag->kirby()->option('kirbytext.video.options', []),
[
'height' => $tag->height ?? $tag->kirby()->option('kirbytext.video.height'),
'width' => $tag->width ?? $tag->kirby()->option('kirbytext.video.width'),
]
);
return Html::figure([$video], $tag->caption, [
'class' => $tag->class ?? $tag->kirby()->option('kirbytext.video.class', 'video'),
'height' => $tag->height ?? $tag->kirby()->option('kirbytext.video.height'),
'width' => $tag->width ?? $tag->kirby()->option('kirbytext.video.width'),
'class' => $tag->class ?? $tag->kirby()->option('kirbytext.video.class', 'video'),
]);
}
],