Skip to content

Commit

Permalink
Merge pull request #6695 from getkirby/release/4.4.1
Browse files Browse the repository at this point in the history
4.4.1
  • Loading branch information
bastianallgeier authored Sep 23, 2024
2 parents d14bc47 + 4ff0da0 commit eb47158
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 98 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "The Kirby core",
"license": "proprietary",
"type": "kirby-cms",
"version": "4.4.0",
"version": "4.4.1",
"keywords": [
"kirby",
"cms",
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions config/areas/site/requests.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,19 @@
'action' => function () {
$kirby = App::instance();
$request = $kirby->request();
$root = $request->get('root');
$page = $kirby->page($request->get('page'));
$parents = $page?->parents()->flip()->values(
fn ($parent) => $parent->uuid()?->toString() ?? $parent->id()
) ?? [];

// if root is included, add the site as top-level parent
if ($root === 'true') {
array_unshift($parents, $kirby->site()->uuid()?->toString() ?? '/');
}

return [
'data' => $page->parents()->flip()->values(
fn ($parent) => $parent->uuid()?->toString() ?? $parent->id()
)
'data' => $parents
];
}
]
Expand Down
10 changes: 5 additions & 5 deletions i18n/translations/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@
"error.form.notSaved": "항목을 저장할 수 없습니다.",

"error.language.code": "올바른 언어 코드를 입력하세요.",
"error.language.create.permission": "You are not allowed to create a language",
"error.language.delete.permission": "You are not allowed to delete the language",
"error.language.create.permission": "언어를 등록할 권한이 없습니다.",
"error.language.delete.permission": "언어를 삭제할 권한이 없습니다.",
"error.language.duplicate": "이미 등록한 언어입니다.",
"error.language.name": "올바른 언어명을 입력하세요.",
"error.language.notFound": "언어를 찾을 수 없습니다.",
"error.language.update.permission": "You are not allowed to update the language",
"error.language.update.permission": "언어를 변경할 권한이 없습니다.",

"error.layout.validation.block": "레이아웃({layoutIndex})의 특정 블록 유형({fieldset})을 사용하는 블록({blockIndex})의 특정 필드({field})에 오류가 있습니다.",
"error.layout.validation.settings": "레이아웃({index}) 옵션을 확인하세요.",
Expand Down Expand Up @@ -620,8 +620,8 @@
"stats.empty": "관련 기록이 없습니다.",
"status": "상태",

"system.info.copy": "Copy info",
"system.info.copied": "System info copied",
"system.info.copy": "정보 복사",
"system.info.copied": "시스템 정보가 복사되었습니다.",
"system.issues.content": "<code>/content</code> 폴더의 권한을 확인하세요.",
"system.issues.eol.kirby": "설치된 Kirby 버전이 만료되었습니다. 더 이상 보안 업데이트를 받을 수 없습니다.",
"system.issues.eol.plugin": "설치된 플러그인({plugin}의 지원이 종료되었습니다. 더 이상 보안 업데이트를 받을 수 없습니다.",
Expand Down
2 changes: 1 addition & 1 deletion panel/dist/js/index.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion panel/src/components/Misc/OfflineWarning.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div v-if="$panel.isOffline" class="k-offline-warning">
<div v-if="!$panel.system.isLocal && $panel.isOffline" class="k-offline-warning">
<p><k-icon type="bolt" /> {{ $t("error.offline") }}</p>
</div>
</template>
Expand Down
22 changes: 15 additions & 7 deletions panel/src/components/Navigation/PageTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ export default {
});
},
async open(item) {
if (!item) {
return;
}
if (item.hasChildren === false) {
return false;
}
Expand All @@ -79,30 +83,34 @@ export default {
// get array of parent uuids/ids
const response = await this.$panel.get("site/tree/parents", {
query: {
page
page,
root: this.root
}
});
const parents = response.data;
// if root is included, add the site as top-level parent
if (this.root) {
parents.unshift("site://");
}
let tree = this;
// go through all parents, try to find the matching item,
// open it and pass forward the pointer to that tree component
for (let index = 0; index < parents.length; index++) {
const value = parents[index];
const item = tree.findItem(value);
if (!item) {
return;
}
await this.open(item);
tree = tree.$refs[value][0];
}
// find current page in deepest tree and trigger select listeners
const item = tree.findItem(page);
this.$emit("select", item);
if (item) {
this.$emit("select", item);
}
}
}
};
Expand Down
20 changes: 1 addition & 19 deletions src/Cms/LanguageRoutes.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Kirby\Cms;

use Kirby\Filesystem\F;
use Kirby\Toolkit\Str;

class LanguageRoutes
{
Expand All @@ -30,26 +29,9 @@ public static function create(App $kirby): array
'pattern' => $language->pattern(),
'method' => 'ALL',
'env' => 'site',
'action' => function ($path = null) use ($kirby, $language) {
'action' => function ($path = null) use ($language) {
$result = $language->router()->call($path);

// redirect secondary-language pages that have
// been accessed with non-translated slugs in their path
// to their fully translated URL
if ($path !== null && $result instanceof Page) {
if (Str::endsWith($result->url(), $path) === false) {
$url = $result->url();
$query = $kirby->request()->query()->toString();

// preserve query across redirect
if (empty($query) === false) {
$url .= '?' . $query;
}

return $kirby->response()->redirect($url);
}
}

// explicitly test for null as $result can
// contain falsy values that should still be returned
if ($result !== null) {
Expand Down
11 changes: 5 additions & 6 deletions src/Filesystem/Filename.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Kirby\Filesystem;

use Kirby\Cms\App;
use Kirby\Cms\Language;
use Kirby\Toolkit\Str;

Expand Down Expand Up @@ -49,7 +48,8 @@ class Filename
public function __construct(
protected string $filename,
protected string $template,
protected array $attributes = []
protected array $attributes = [],
protected string|null $language = null
) {
$this->name = $this->sanitizeName($filename);
$this->extension = $this->sanitizeExtension(
Expand Down Expand Up @@ -234,13 +234,12 @@ protected function sanitizeName(string $name): string
{
// temporarily store language rules
$rules = Str::$language;
$kirby = App::instance(null, true);

// if current user, add rules for their language to `Str` class
if ($user = $kirby?->user()) {
// add rules for a particular language to `Str` class
if ($this->language !== null) {
Str::$language = [
...Str::$language,
...Language::loadRules($user->language())];
...Language::loadRules($this->language)];
}

// sanitize name
Expand Down
38 changes: 0 additions & 38 deletions tests/Cms/Languages/LanguageRoutesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,42 +122,4 @@ public function testNotNextWhenFalsyReturn()
$this->assertSame(1, $d);
$this->assertSame(2, $e);
}

public function testRedirectWhenNonTranslatedSlugs()
{
$app = $this->app->clone([
'site' => [
'children' => [
[
'slug' => 'page1',
'translations' => [
[
'code' => 'en',
],
[
'code' => 'de',
'slug' => 'seite1',
]
]
]
]
],
'request' => [
'query' => [
'foo' => 'bar',
]
]
]);

$result = $app->call('page1');
$this->assertSame($app->page('page1'), $result);

$result = $app->call('de/page1');
$this->assertInstanceOf(Responder::class, $result);
$this->assertSame(302, $result->code());
$this->assertSame('/de/seite1?foo=bar', $result->header('Location'));

$result = $app->call('de/seite1');
$this->assertSame($app->page('page1'), $result);
}
}
19 changes: 9 additions & 10 deletions tests/Filesystem/FilenameTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Kirby\Filesystem;

use Kirby\Cms\App;
use Kirby\TestCase as TestCase;

/**
Expand Down Expand Up @@ -291,6 +290,7 @@ public function testGrayscale($prop, $value, $expected)

/**
* @covers ::name
* @covers ::sanitizeName
*/
public function testName()
{
Expand All @@ -300,6 +300,7 @@ public function testName()

/**
* @covers ::name
* @covers ::sanitizeName
*/
public function testNameSanitization()
{
Expand All @@ -309,18 +310,16 @@ public function testNameSanitization()

/**
* @covers ::name
* @covers ::sanitizeName
*/
public function testNameSanitizationUserLanguageRules()
public function testNameSanitizationWithLanguageRules()
{
$app = new App([
'users' => [
['email' => '[email protected]', 'language' => 'ko']
]
]);

$app->impersonate('[email protected]');
$name = new Filename(
filename: '/var/www/안녕하세요.pdf',
template: '{{ name }}.{{ extension }}',
language: 'ko'
);

$name = new Filename('/var/www/안녕하세요.pdf', '{{ name }}.{{ extension }}');
$this->assertSame('annyeonghaseyo', $name->name());
}

Expand Down
12 changes: 6 additions & 6 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php return array(
'root' => array(
'name' => 'getkirby/cms',
'pretty_version' => '4.4.0',
'version' => '4.4.0.0',
'reference' => NULL,
'pretty_version' => '4.4.1',
'version' => '4.4.1.0',
'reference' => null,
'type' => 'kirby-cms',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand Down Expand Up @@ -47,9 +47,9 @@
'dev_requirement' => false,
),
'getkirby/cms' => array(
'pretty_version' => '4.4.0',
'version' => '4.4.0.0',
'reference' => NULL,
'pretty_version' => '4.4.1',
'version' => '4.4.1.0',
'reference' => null,
'type' => 'kirby-cms',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand Down

0 comments on commit eb47158

Please sign in to comment.