diff --git a/app/webroot/theme/admin-third/Elements/admin/themes/index_list.php b/app/webroot/theme/admin-third/Elements/admin/themes/index_list.php index 2c3396da66..de4b6cc127 100755 --- a/app/webroot/theme/admin-third/Elements/admin/themes/index_list.php +++ b/app/webroot/theme/admin-third/Elements/admin/themes/index_list.php @@ -35,7 +35,9 @@
- BcBaser->link('', ['controller' => 'theme_files', 'action' => 'index', $currentTheme['name']], ['title' => __d('baser', 'テンプレート編集'), 'class' => 'bca-btn-icon', 'data-bca-btn-type' => 'file-list', 'data-bca-btn-size' => 'lg']) ?> + + BcBaser->link('', ['controller' => 'theme_files', 'action' => 'index', $currentTheme['name']], ['title' => __d('baser', 'テンプレート編集'), 'class' => 'bca-btn-icon', 'data-bca-btn-type' => 'file-list', 'data-bca-btn-size' => 'lg']) ?> + BcBaser->link('', ['action' => 'ajax_copy', $currentTheme['name']], ['title' => __d('baser', 'テーマコピー'), 'class' => 'btn-copy bca-btn-icon', 'data-bca-btn-type' => 'copy', 'data-bca-btn-size' => 'lg']) ?>
@@ -74,4 +76,4 @@

  • baserマーケットでテーマをダウンロードしましょう。') ?>
  • - \ No newline at end of file + diff --git a/app/webroot/theme/admin-third/Elements/admin/themes/index_row.php b/app/webroot/theme/admin-third/Elements/admin/themes/index_row.php index 44ebd89e06..8b52c6181c 100755 --- a/app/webroot/theme/admin-third/Elements/admin/themes/index_row.php +++ b/app/webroot/theme/admin-third/Elements/admin/themes/index_row.php @@ -31,7 +31,9 @@ BcBaser->siteConfig['theme']): ?> BcBaser->link('', ['action' => 'apply', $data['name']], ['title' => __d('baser', '適用'), 'class' => 'submit-token bca-btn-icon', 'data-bca-btn-type' => 'apply', 'data-bca-btn-size' => 'lg']) ?> + BcBaser->link('', ['controller' => 'theme_files', 'action' => 'index', $data['name']], ['title' => __d('baser', 'テンプレート編集'), 'class' => 'bca-btn-icon', 'data-bca-btn-type' => 'file-list', 'data-bca-btn-size' => 'lg']) ?> + BcBaser->link('', ['action' => 'ajax_copy', $data['name']], ['title' => __d('baser', 'テーマコピー'), 'class' => 'btn-copy bca-btn-icon', 'data-bca-btn-type' => 'copy', 'data-bca-btn-size' => 'lg']) ?> BcBaser->link('', ['action' => 'ajax_delete', $data['name']], ['title' => __d('baser', 'テーマ削除'), 'class' => 'btn-delete bca-btn-icon', 'data-bca-btn-type' => 'delete', 'data-bca-btn-size' => 'lg']) ?>

    diff --git a/app/webroot/theme/admin-third/ThemeFiles/admin/form.php b/app/webroot/theme/admin-third/ThemeFiles/admin/form.php index e5bec1b5e3..a1a33e5c89 100755 --- a/app/webroot/theme/admin-third/ThemeFiles/admin/form.php +++ b/app/webroot/theme/admin-third/ThemeFiles/admin/form.php @@ -105,12 +105,13 @@
    BcBaser->link(__d('baser', '削除'), array_merge(['action' => 'del', $theme, $plugin, $type], $params), ['class' => 'submit-token button bca-btn', 'data-bca-btn-type' => 'delete', 'data-bca-btn-size' => 'sm'], sprintf(__d('baser', '%s を本当に削除してもいいですか?'), basename($path)), false) ?>
    - + - + + BcBaser->link(__d('baser', '現在のテーマにコピー'), array_merge(array('action' => 'copy_to_theme', $theme, $plugin, $type), explode('/', $path)), array('class' => 'submit-token btn-red button bca-btn'), sprintf(__d('baser', '本当に現在のテーマ「%s」にコピーしてもいいですか?\n既に存在するファイルは上書きされます。'), Inflector::camelize($siteConfig['theme']))); ?> diff --git a/lib/Baser/Config/setting.php b/lib/Baser/Config/setting.php index 36a601675f..d0579525be 100755 --- a/lib/Baser/Config/setting.php +++ b/lib/Baser/Config/setting.php @@ -176,6 +176,8 @@ 'validSyntaxWithPage' => true, // 管理者以外のPHPコードを許可するかどうか 'allowedPhpOtherThanAdmins' => true, + // テーマ編集機能の利用を許可するかどうか + 'allowedThemeEdit' => false, 'marketThemeRss' => 'https://market.basercms.net/themes.rss', 'marketPluginRss' => 'https://market.basercms.net/plugins.rss', 'specialThanks' => 'https://basercms.net/special_thanks/special_thanks/ajax_users', diff --git a/lib/Baser/Controller/ThemeFilesController.php b/lib/Baser/Controller/ThemeFilesController.php index 464238d675..398a4fd5b7 100644 --- a/lib/Baser/Controller/ThemeFilesController.php +++ b/lib/Baser/Controller/ThemeFilesController.php @@ -74,6 +74,24 @@ public function __construct(CakeRequest $request, CakeResponse $response) { $this->crumbs = [ ['name' => __d('baser', 'テーマ管理'), 'url' => ['admin' => true, 'controller' => 'themes', 'action' => 'index']] ]; + + // テーマ編集機能が制限されている場合はアクセス禁止 + if (Configure::read('BcApp.allowedThemeEdit') == false) { + $denyList = [ + 'admin_index', + 'admin_add', + 'admin_edit', + 'admin_add_folder', + 'admin_edit_folder', + ]; + // coreのindexはアクセス可能 + if ($this->request->params['pass'][0] === 'core') { + unset($denyList[array_search('admin_index', $denyList)]); + } + if (in_array($this->request->action, $denyList)) { + $this->notfound(); + } + } } /** @@ -136,13 +154,13 @@ public function admin_index() { $excludeFileList = ['screenshot.png', 'VERSION.txt', 'config.php', 'AppView.php', 'BcAppView.php']; if (!$path) { $excludeFolderList = [ - 'Layouts', - 'Elements', + 'Layouts', + 'Elements', 'Emails', - 'Helper', + 'Helper', 'Config', - 'Plugin', - 'img', + 'Plugin', + 'img', 'css', 'js', '_notes' @@ -185,9 +203,9 @@ public function admin_index() { /** * ファイルタイプを取得する - * + * * @param string $file - * @return mixed false / type + * @return mixed false / type */ protected function _getFileType($file) { if (preg_match('/^(.+?)(\.ctp|\.php|\.css|\.js)$/is', $file)) { @@ -873,7 +891,7 @@ public function admin_copy_folder_to_theme() { /** * 画像を表示する * コアの画像等も表示可 - * + * * @param array パス情報 * @return void */ @@ -901,7 +919,7 @@ public function admin_img() { /** * 画像を表示する * コアの画像等も表示可 - * + * * @param int $width * @param int $height * @param array パス情報 diff --git a/lib/Baser/View/Elements/admin/themes/index_list.php b/lib/Baser/View/Elements/admin/themes/index_list.php index e777c39905..6daf0fa481 100755 --- a/lib/Baser/View/Elements/admin/themes/index_list.php +++ b/lib/Baser/View/Elements/admin/themes/index_list.php @@ -35,7 +35,9 @@

    - BcBaser->link($this->BcBaser->getImg('admin/icn_tool_manage.png', ['alt' => __d('baser', 'テンプレート編集'), 'class' => 'btn']), ['controller' => 'theme_files', 'action' => 'index', $currentTheme['name']], ['title' => __d('baser', 'テンプレート編集')]) ?> + + BcBaser->link($this->BcBaser->getImg('admin/icn_tool_manage.png', ['alt' => __d('baser', 'テンプレート編集'), 'class' => 'btn']), ['controller' => 'theme_files', 'action' => 'index', $currentTheme['name']], ['title' => __d('baser', 'テンプレート編集')]) ?> + BcBaser->link($this->BcBaser->getImg('admin/icn_tool_copy.png', ['alt' => __d('baser', 'テーマコピー'), 'class' => 'btn']), ['action' => 'ajax_copy', $currentTheme['name']], ['title' => __d('baser', 'テーマコピー'), 'class' => 'btn-copy']) ?>

    @@ -76,4 +78,4 @@

  • でテーマをダウンロードしましょう。')?>
  • - \ No newline at end of file + diff --git a/lib/Baser/View/Elements/admin/themes/index_row.php b/lib/Baser/View/Elements/admin/themes/index_row.php index 9ecb0a0087..fae1f0f461 100755 --- a/lib/Baser/View/Elements/admin/themes/index_row.php +++ b/lib/Baser/View/Elements/admin/themes/index_row.php @@ -31,7 +31,9 @@ BcBaser->siteConfig['theme']): ?> BcBaser->link($this->BcBaser->getImg('admin/icn_tool_apply.png', ['alt' => __d('baser', '適用'), 'class' => 'btn']), ['action' => 'apply', $data['name']], ['title' => __d('baser', '適用'), 'class' => 'submit-token']) ?> - BcBaser->link($this->BcBaser->getImg('admin/icn_tool_manage.png', ['alt' => __d('baser', 'テンプレート編集'), 'class' => 'btn']), ['controller' => 'theme_files', 'action' => 'index', $data['name']], ['title' => __d('baser', 'テンプレート編集')]) ?> + + BcBaser->link($this->BcBaser->getImg('admin/icn_tool_manage.png', ['alt' => __d('baser', 'テンプレート編集'), 'class' => 'btn']), ['controller' => 'theme_files', 'action' => 'index', $data['name']], ['title' => __d('baser', 'テンプレート編集')]) ?> + BcBaser->link($this->BcBaser->getImg('admin/icn_tool_copy.png', ['alt' => __d('baser', 'テーマコピー'), 'class' => 'btn']), ['action' => 'ajax_copy', $data['name']], ['title' => __d('baser', 'テーマコピー'), 'class' => 'btn-copy']) ?> BcBaser->link($this->BcBaser->getImg('admin/icn_tool_delete.png', ['alt' => __d('baser', 'テーマ削除'), 'class' => 'btn']), ['action' => 'ajax_delete', $data['name']], ['title' => __d('baser', 'テーマ削除'), 'class' => 'btn-delete']) ?>

    diff --git a/lib/Baser/View/ThemeFiles/admin/form.php b/lib/Baser/View/ThemeFiles/admin/form.php index 47c2da94d3..6de8df70b3 100755 --- a/lib/Baser/View/ThemeFiles/admin/form.php +++ b/lib/Baser/View/ThemeFiles/admin/form.php @@ -102,13 +102,14 @@ BcForm->submit(__d('baser', '保存'), ['div' => false, 'class' => 'button', 'id' => 'BtnSave']) ?> BcBaser->link(__d('baser', '削除'), array_merge(['action' => 'del', $theme, $plugin, $type], $params), ['class' => 'submit-token button'], sprintf(__d('baser', '%s を本当に削除してもいいですか?'), basename($path)), false) ?> - + BcBaser->link(__d('baser', '一覧に戻る'), array_merge(['action' => 'index', $theme, $plugin, $type], $parentPrams), ['class' => 'btn-gray button']); ?> - + + BcBaser->link(__d('baser', '現在のテーマにコピー'), array_merge(['action' => 'copy_to_theme', $theme, $plugin, $type], explode('/', $path)), ['class' => 'submit-token btn-red button'], sprintf(__d('baser', "本当に現在のテーマ「 %s 」にコピーしてもいいですか?\n既に存在するファイルは上書きされます。"), Inflector::camelize($siteConfig['theme']))); ?>