Upgrade to 4.1.1

This commit is contained in:
Bastian Allgeier
2024-02-26 11:15:36 +01:00
parent 9345fc1a0b
commit 2e8aa1ed80
20 changed files with 123 additions and 171 deletions

View File

@@ -1,6 +1,8 @@
<?php
use Kirby\Exception\Exception;
use Kirby\Filesystem\F;
use Kirby\Toolkit\Str;
/**
* User Routes
@@ -79,10 +81,27 @@ return [
],
'method' => 'POST',
'action' => function (string $id) {
$this->user($id)->avatar()?->delete();
return $this->upload(
function ($source, $filename) use ($id) {
$type = F::type($filename);
if ($type !== 'image') {
throw new Exception([
'key' => 'file.type.invalid',
'data' => compact('type')
]);
}
$mime = F::mime($source);
if (Str::startsWith($mime, 'image/') !== true) {
throw new Exception([
'key' => 'file.mime.invalid',
'data' => compact('mime')
]);
}
// delete the old avatar
$this->user($id)->avatar()?->delete();
$props = [
'filename' => 'profile.' . F::extension($filename),
'template' => 'avatar',

View File

@@ -22,8 +22,7 @@ return [
'file',
'email',
'tel',
'anchor',
'custom'
'anchor'
];
},
'value' => function (string|null $value = null) {

View File

@@ -8,7 +8,7 @@ return [
],
'props' => [
/**
* Array or query string for reports. Each report needs a `label` and `value` and can have additional `info`, `link` and `theme` settings.
* Array or query string for reports. Each report needs a `label` and `value` and can have additional `info`, `link`, `icon` and `theme` settings.
*/
'reports' => function ($reports = null) {
if ($reports === null) {