Skip to content

Commit c8ae95e

Browse files
committed
Merge branch '5.1.x' into 5.2.x
2 parents 85f177a + 5451965 commit c8ae95e

File tree

21 files changed

+208
-44
lines changed

21 files changed

+208
-44
lines changed

plugins/baser-core/src/BaserCorePlugin.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,10 @@ public function setupThemePlugin(array $themes): void
251251
$path = [];
252252
foreach($themes as $theme) {
253253
$pluginsPath = CorePlugin::path($theme) . 'plugins' . DS;
254+
// path() を実行するとプラグインクラスがコレクションに登録されてしまう
255+
// ここで登録されてしまうと、対象プラグインの bootstrap() が正常に実行されないため
256+
// ここでは一旦削除する。
257+
CorePlugin::getCollection()->remove($theme);
254258
if (!is_dir($pluginsPath)) continue;
255259
$path[] = $pluginsPath;
256260
}
@@ -280,7 +284,16 @@ public function getAvailableThemes(): array
280284
$themes = [];
281285
foreach($sites as $site) {
282286
if ($site->theme) {
283-
if (!CorePlugin::isLoaded($site->theme) && !is_dir(CorePlugin::path($site->theme))) continue;
287+
if (!CorePlugin::isLoaded($site->theme)) {
288+
$pluginPath = CorePlugin::path($site->theme);
289+
// path() を実行するとプラグインクラスがコレクションに登録されてしまう
290+
// ここで登録されてしまうと、対象プラグインの bootstrap() が正常に実行されないため
291+
// ここでは一旦削除する。
292+
CorePlugin::getCollection()->remove($site->theme);
293+
if(!is_dir($pluginPath)) {
294+
continue;
295+
}
296+
}
284297
if(in_array($site->theme, $themes)) continue;
285298
$themes[] = $site->theme;
286299
}

plugins/baser-core/src/Service/PermissionsService.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,19 @@ private function checkGroup(
456456
return true;
457457
}
458458

459+
// RESTful なルーティングに対応
460+
// URL上アクションがなく、parseRequest で、アクションが index に設定された場合、
461+
// POST メソッドであれば add アクションに変換する
462+
if(!empty($urlArray['_ext'])
463+
&& $urlArray['_ext'] === 'json'
464+
&& $urlArray['action'] === 'index'
465+
&& $method === 'POST'
466+
) {
467+
if(!preg_match('/\/index\.json$/', $url)) {
468+
$url = preg_replace('/\.json$/', '/add.json', $url);
469+
}
470+
}
471+
459472
// プレフィックスがない場合はフロントとみなす
460473
if(empty($urlArray['prefix'])) {
461474
$prefix = 'Front';

plugins/baser-core/src/Service/UsersService.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@
1717
use BaserCore\Model\Entity\User;
1818
use BaserCore\Model\Table\LoginStoresTable;
1919
use BaserCore\Model\Table\UsersTable;
20-
use BaserCore\Service\SiteConfigsServiceInterface;
2120
use BaserCore\Utility\BcContainerTrait;
2221
use BaserCore\Utility\BcUtil;
2322
use Cake\Core\Configure;
24-
use Cake\Core\Exception\Exception;
2523
use Cake\Http\Cookie\Cookie;
2624
use Cake\Http\ServerRequest;
2725
use Cake\ORM\Query;
@@ -40,6 +38,7 @@
4038
* @property UsersTable $Users
4139
* @property LoginStoresTable $LoginStores
4240
*/
41+
#[\AllowDynamicProperties]
4342
class UsersService implements UsersServiceInterface
4443
{
4544

plugins/baser-core/src/Utility/BcUtil.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ public static function getDbVersion($plugin = '')
352352
*/
353353
public static function verpoint($version)
354354
{
355+
if(!$version) return 0;
355356
$version = str_replace('baserCMS ', '', $version);
356357
if (preg_match("/([0-9]+)\.([0-9]+)\.([0-9]+)([\sa-z\-]+|\.[0-9]+|)([\sa-z\-]+|\.[0-9]+|)/is", $version, $maches)) {
357358
if (isset($maches[4]) && preg_match('/^\.[0-9]+$/', $maches[4])) {

plugins/baser-core/src/View/Helper/BcBaserHelper.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@
159159
* @method bool isDisplayCustomField(CustomEntry $entry, string $fieldName)
160160
* @method string getCustomFieldTitle(mixed $entry, string $fieldName)
161161
* @method string|array getCustomFieldValue(mixed $entry, string $fieldName, array $options = [])
162+
* @method string getCustomEntries(int $tableId, int $limit, array $options = [])
163+
* @method string customEntries(int $tableId, int $limit, array $options = [])
162164
*
163165
* ### TextHelper
164166
* @method string truncateText(string $text, int $length = 100, array $options = [])

plugins/bc-admin-third/src/bc_blog/js/admin/blog_posts/form.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ $(function () {
191191
$.bcToken.check(function () {
192192
return $.ajax({
193193
type: "post",
194-
url: $.bcUtil.apiAdminBaseUrl + 'bc-blog/blog_categories.json',
194+
url: $.bcUtil.apiAdminBaseUrl + 'bc-blog/blog_categories/add.json',
195195
data: {
196196
'blog_content_id': blogContentId,
197197
'name': name,

plugins/bc-admin-third/templates/plugin/BcBlog/Admin/element/BlogCategories/index_row.php

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -56,26 +56,24 @@
5656
'data-bca-btn-type' => 'preview',
5757
'data-bca-btn-size' => 'lg']
5858
) ?>
59-
<?php if (\BaserCore\Utility\BcUtil::isAdminUser()): ?>
60-
<?php $this->BcBaser->link('',
61-
['action' => 'edit', $blogContent->id, $blogCategory->id],
62-
[
63-
'title' => __d('baser_core', '編集'),
64-
'class' => 'bca-btn-icon',
65-
'data-bca-btn-type' => 'edit',
66-
'data-bca-btn-size' => 'lg'
67-
]
68-
) ?>
69-
<?= $this->BcAdminForm->postLink('',
70-
['action' => 'delete', $blogContent->id, $blogCategory->id],
71-
[
72-
'confirm' => __d('baser_core', "このデータを本当に削除してもいいですか?\n\nこのカテゴリに関連する記事は、どのカテゴリにも関連しない状態として残ります。"),
73-
'title' => __d('baser_core', '削除'),
74-
'class' => 'btn-delete bca-btn-icon',
75-
'data-bca-btn-type' => 'delete',
76-
'data-bca-btn-size' => 'lg',
77-
]
78-
) ?>
79-
<?php endif ?>
59+
<?php $this->BcBaser->link('',
60+
['action' => 'edit', $blogContent->id, $blogCategory->id],
61+
[
62+
'title' => __d('baser_core', '編集'),
63+
'class' => 'bca-btn-icon',
64+
'data-bca-btn-type' => 'edit',
65+
'data-bca-btn-size' => 'lg'
66+
]
67+
) ?>
68+
<?= $this->BcAdminForm->postLink('',
69+
['action' => 'delete', $blogContent->id, $blogCategory->id],
70+
[
71+
'confirm' => __d('baser_core', "このデータを本当に削除してもいいですか?\n\nこのカテゴリに関連する記事は、どのカテゴリにも関連しない状態として残ります。"),
72+
'title' => __d('baser_core', '削除'),
73+
'class' => 'btn-delete bca-btn-icon',
74+
'data-bca-btn-type' => 'delete',
75+
'data-bca-btn-size' => 'lg',
76+
]
77+
) ?>
8078
</td>
8179
</tr>

plugins/bc-admin-third/webpack.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ module.exports = {
3636
path: path.join(__dirname, 'webroot/js')
3737
},
3838
resolve: {
39-
alias: {
40-
process: "process/browser"
41-
}
39+
fallback: {
40+
'process/browser': require.resolve('process/browser'),
41+
},
4242
},
4343
optimization: {
4444
splitChunks: {

plugins/bc-admin-third/webroot/bc_blog/js/admin/blog_posts/form.bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)