diff --git a/config/.env.example b/config/.env.example index c3aa657064..5bfbfe81a6 100644 --- a/config/.env.example +++ b/config/.env.example @@ -23,7 +23,6 @@ export APP_DEFAULT_TIMEZONE="Asia/Tokyo" export INSTALL_MODE="true" export USE_DEBUG_KIT="false" export SITE_URL="https://localhost/" -export SSL_URL="https://localhost/" export ADMIN_PREFIX="admin" export BASER_CORE_PREFIX="baser" export SQL_LOG="false" diff --git a/plugins/baser-core/config/setting.php b/plugins/baser-core/config/setting.php index 3d05bde08c..9421896892 100644 --- a/plugins/baser-core/config/setting.php +++ b/plugins/baser-core/config/setting.php @@ -157,10 +157,6 @@ * サイトURL */ 'siteUrl' => env('SITE_URL', 'https://localhost/'), - /** - * SSL URL - */ - 'sslUrl' => env('SSL_URL', 'https://localhost/'), /** * CMS URL * CMSのURLが別ドメインの場合に設定する diff --git a/plugins/baser-core/src/Controller/Admin/BcAdminAppController.php b/plugins/baser-core/src/Controller/Admin/BcAdminAppController.php index 2d2281338b..d1dc613ca3 100644 --- a/plugins/baser-core/src/Controller/Admin/BcAdminAppController.php +++ b/plugins/baser-core/src/Controller/Admin/BcAdminAppController.php @@ -183,7 +183,7 @@ protected function _checkReferer(): bool } /** - * siteUrlや、sslUrlと現在のURLが違う場合には、そちらのURLにリダイレクトを行う + * siteUrlや、cmsUrlと現在のURLが違う場合には、そちらのURLにリダイレクトを行う * setting.php にて、cmsUrlとして、cmsUrlを定義した場合にはそちらを優先する * @return Response|void|null * @checked @@ -194,8 +194,6 @@ public function redirectIfIsNotSameSite() { if (Configure::read('BcEnv.cmsUrl')) { $siteUrl = Configure::read('BcEnv.cmsUrl'); - } elseif ($this->getRequest()->is('https')) { - $siteUrl = Configure::read('BcEnv.sslUrl'); } else { $siteUrl = Configure::read('BcEnv.siteUrl'); } diff --git a/plugins/baser-core/src/Model/Table/SiteConfigsTable.php b/plugins/baser-core/src/Model/Table/SiteConfigsTable.php index bd497be7b1..41f2ab588a 100755 --- a/plugins/baser-core/src/Model/Table/SiteConfigsTable.php +++ b/plugins/baser-core/src/Model/Table/SiteConfigsTable.php @@ -85,10 +85,6 @@ public function validationKeyValue(Validator $validator): Validator ->scalar('site_url') ->regex('site_url', '/^(http|https):/', __d('baser_core', 'WebサイトURLはURLの形式を入力してください。')) ->notEmptyString('site_url', __d('baser_core', 'WebサイトURLを入力してください。')); - $validator - ->scalar('ssl_url') - ->regex('ssl_url', '/^(http|https):/', __d('baser_core', 'WebサイトURLはURLの形式を入力してください。')) - ->notEmptyString('ssl_url', __d('baser_core', 'WebサイトURLを入力してください。')); return $validator; } diff --git a/plugins/baser-core/src/Service/PermissionsService.php b/plugins/baser-core/src/Service/PermissionsService.php index db6800690b..613d66975e 100644 --- a/plugins/baser-core/src/Service/PermissionsService.php +++ b/plugins/baser-core/src/Service/PermissionsService.php @@ -441,8 +441,8 @@ private function checkGroup( { // ドメイン部分を除外 if(preg_match('/^(http(s|):\/\/[^\/]+?\/)(.*?)$/', $url, $matches)) { - if(in_array($matches[1], [Configure::read('BcEnv.siteUrl'), Configure::read('BcEnv.sslUrl')])) { - $url = str_replace([Configure::read('BcEnv.siteUrl'), Configure::read('BcEnv.sslUrl')], '', $url); + if(in_array($matches[1], [Configure::read('BcEnv.siteUrl')])) { + $url = str_replace([Configure::read('BcEnv.siteUrl')], '', $url); if(!$url) $url = '/'; } else { return true; diff --git a/plugins/baser-core/src/Service/SiteConfigsService.php b/plugins/baser-core/src/Service/SiteConfigsService.php index 9dcfad37e8..b4a861cd32 100644 --- a/plugins/baser-core/src/Service/SiteConfigsService.php +++ b/plugins/baser-core/src/Service/SiteConfigsService.php @@ -98,7 +98,6 @@ public function get(): SiteConfig $this->entity = $this->SiteConfigs->newEntity(array_merge($this->SiteConfigs->getKeyValue(), [ 'mode' => Configure::read('debug'), 'site_url' => Configure::read('BcEnv.siteUrl'), - 'ssl_url' => Configure::read('BcEnv.sslUrl'), ]), ['validate' => 'keyValue']); } return $this->entity; @@ -132,22 +131,16 @@ public function update(array $postData) if ($siteConfig->site_url && !preg_match('/\/$/', $siteConfig->site_url)) { $siteConfig->site_url .= '/'; } - if ($siteConfig->ssl_url && !preg_match('/\/$/', $siteConfig->ssl_url)) { - $siteConfig->ssl_url .= '/'; - } if ($this->isWritableEnv()) { if (isset($siteConfig->mode)) $this->putEnv('DEBUG', ($siteConfig->mode)? 'true' : 'false'); if (isset($siteConfig->site_url)) $this->putEnv('SITE_URL', $siteConfig->site_url); - if (isset($siteConfig->ssl_url)) $this->putEnv('SSL_URL', $siteConfig->ssl_url); } $siteConfigArray = $siteConfig->toArray(); unset($siteConfigArray['mode'], $siteConfigArray['site_url'], - $siteConfigArray['ssl_url'], $siteConfigArray['dummy-site_url'], - $siteConfigArray['dummy-ssl_url'] ); if ($this->SiteConfigs->saveKeyValue($siteConfigArray)) { diff --git a/plugins/baser-core/src/View/Helper/BcBaserHelper.php b/plugins/baser-core/src/View/Helper/BcBaserHelper.php index bee169518e..139dff37c7 100755 --- a/plugins/baser-core/src/View/Helper/BcBaserHelper.php +++ b/plugins/baser-core/src/View/Helper/BcBaserHelper.php @@ -2341,32 +2341,26 @@ public function getSiteName() /** * WebサイトURLを出力する * - * @param bool ssl (初期値 : false) * @return void * @checked * @noTodo * @unitTest */ - public function siteUrl($ssl = false) + public function siteUrl() { - echo $this->getSiteUrl($ssl); + echo $this->getSiteUrl(); } /** * WebサイトURLを取得する * - * @param bool ssl (初期値 : false) * @return string サイト基本設定のWebサイト名 * @checked * @noTodo */ - public function getSiteUrl($ssl = false) + public function getSiteUrl() { - if ($ssl) { - return Configure::read('BcEnv.sslUrl'); - } else { - return Configure::read('BcEnv.siteUrl'); - } + return Configure::read('BcEnv.siteUrl'); } /** diff --git a/plugins/baser-core/src/View/Helper/BcSmartphoneHelper.php b/plugins/baser-core/src/View/Helper/BcSmartphoneHelper.php index 49d4de256c..943c65fc14 100755 --- a/plugins/baser-core/src/View/Helper/BcSmartphoneHelper.php +++ b/plugins/baser-core/src/View/Helper/BcSmartphoneHelper.php @@ -62,16 +62,12 @@ public function afterLayout($layoutFile) // 内部リンクの自動変換 if ($site->auto_link) { $siteUrl = Configure::read('BcEnv.siteUrl'); - $sslUrl = Configure::read('BcEnv.sslUrl'); $currentAlias = $request->getAttribute('currentSite')->alias; $base = '/' . $request->getAttribute('base'); $regBaseUrls = [ preg_quote($base, '/'), preg_quote(preg_replace('/\/$/', '', $siteUrl) . $base, '/'), ]; - if ($sslUrl) { - $regBaseUrls[] = preg_quote(preg_replace('/\/$/', '', $sslUrl) . $base, '/'); - } $regBaseUrl = implode('|', $regBaseUrls); // 一旦プレフィックスを除外 diff --git a/plugins/baser-core/tests/TestCase/Model/Table/SiteConfigsTableTest.php b/plugins/baser-core/tests/TestCase/Model/Table/SiteConfigsTableTest.php index db2579873b..c2b4126a25 100644 --- a/plugins/baser-core/tests/TestCase/Model/Table/SiteConfigsTableTest.php +++ b/plugins/baser-core/tests/TestCase/Model/Table/SiteConfigsTableTest.php @@ -104,7 +104,6 @@ public function testValidationKeyValueRegular() 'name' => 'hoge', 'email' => 'hoge@basercms.net', 'site_url' => 'https://localhost/', - 'ssl_url' => 'https://localhost/', ]); $this->assertEmpty($errors); } @@ -116,18 +115,14 @@ public function testvalidationKeyValueURL() { $validator = $this->SiteConfigs->getValidator('keyValue'); $errors = $validator->validate([ - 'ssl_url' => 'hoge', 'site_url' => 'hoge', ]); - $this->assertEquals('WebサイトURLはURLの形式を入力してください。', current($errors['ssl_url'])); $this->assertEquals('WebサイトURLはURLの形式を入力してください。', current($errors['site_url'])); $validator = $this->SiteConfigs->getValidator('keyValue'); $errors = $validator->validate([ - 'ssl_url' => '/hoge', 'site_url' => '/hoge', ]); - $this->assertEquals('WebサイトURLはURLの形式を入力してください。', current($errors['ssl_url'])); $this->assertEquals('WebサイトURLはURLの形式を入力してください。', current($errors['site_url'])); } diff --git a/plugins/baser-core/tests/TestCase/PluginTest.php b/plugins/baser-core/tests/TestCase/PluginTest.php index 9369c8378f..25c743afe7 100644 --- a/plugins/baser-core/tests/TestCase/PluginTest.php +++ b/plugins/baser-core/tests/TestCase/PluginTest.php @@ -129,7 +129,6 @@ public function testBootStrap(): void export INSTALL_MODE="false" export SITE_URL="https://localhost/" -export SSL_URL="https://localhost/" export ADMIN_PREFIX="admin" export BASER_CORE_PREFIX="baser" export SQL_LOG="false" diff --git a/plugins/baser-core/tests/TestCase/Service/SiteConfigsServiceTest.php b/plugins/baser-core/tests/TestCase/Service/SiteConfigsServiceTest.php index 0dac5f44ed..c10dc0a06b 100644 --- a/plugins/baser-core/tests/TestCase/Service/SiteConfigsServiceTest.php +++ b/plugins/baser-core/tests/TestCase/Service/SiteConfigsServiceTest.php @@ -76,7 +76,6 @@ public function testGet() $result = $this->SiteConfigs->get(); $this->assertArrayHasKey('mode', $result); $this->assertArrayHasKey('site_url', $result); - $this->assertArrayHasKey('ssl_url', $result); } /** diff --git a/plugins/baser-core/tests/TestCase/View/Helper/BcBaserHelperTest.php b/plugins/baser-core/tests/TestCase/View/Helper/BcBaserHelperTest.php index 9c3a55aba2..d9671a1f6c 100644 --- a/plugins/baser-core/tests/TestCase/View/Helper/BcBaserHelperTest.php +++ b/plugins/baser-core/tests/TestCase/View/Helper/BcBaserHelperTest.php @@ -325,12 +325,8 @@ public function testGetLink($title, $url, $option, $expected) if (!empty($option['forceTitle'])) { $this->loginAdmin($this->getRequest('/baser/admin'), 2); } - if (!empty($option['ssl'])) { - Configure::write('BcEnv.sslUrl', 'https://localhost/'); - } $result = $this->BcBaser->getLink($title, $url, $option); $this->assertEquals($expected, $result); - Configure::write('BcEnv.sslUrl', ''); } public static function getLinkDataProvider() @@ -344,9 +340,6 @@ public static function getLinkDataProvider() ['title', 'https://example.com/link', ['escapeTitle' => false], 'title'], // エスケープ ['固定ページ管理', ['prefix' => 'Admin', 'controller' => 'pages', 'action' => 'index'], [], '固定ページ管理'], // プレフィックス ['システム設定', ['Admin' => true, 'controller' => 'site_configs', 'action' => 'index'], ['forceTitle' => true], 'システム設定'], // 強制タイトル - ['会社案内', '/about', ['ssl' => true], '会社案内'], // SSL - ['テーマファイル管理', ['controller' => 'themes', 'action' => 'manage', 'jsa'], ['ssl' => true], 'テーマファイル管理'], // SSL - ['画像', '/img/test.jpg', ['ssl' => true], '画像'], // SSL ]; } @@ -1816,12 +1809,7 @@ public function testGetSiteName() public function testGetSiteUrl() { Configure::write('BcEnv.siteUrl', 'https://basercms.net/'); - Configure::write('BcEnv.sslUrl', 'https://basercms.net/'); - - // http $this->assertEquals('https://basercms.net/', $this->BcBaser->getSiteUrl()); - //https - $this->assertEquals('https://basercms.net/', $this->BcBaser->getSiteUrl(true)); } /** diff --git a/plugins/bc-admin-third/templates/Admin/SiteConfigs/index.php b/plugins/bc-admin-third/templates/Admin/SiteConfigs/index.php index 58bb2c2804..2d7e9c5dc2 100755 --- a/plugins/bc-admin-third/templates/Admin/SiteConfigs/index.php +++ b/plugins/bc-admin-third/templates/Admin/SiteConfigs/index.php @@ -60,21 +60,11 @@ BcAdminForm->unlockFields('dummy-site_url') ?> BcAdminForm->control('site_url', ['type' => 'text', 'size' => 35, 'maxlength' => 255, 'data-margin' => 'bottom', 'disabled' => !$isWritableEnv]) ?> -
- - BcAdminForm->unlockFields('dummy-ssl_url') ?> - BcAdminForm->control('ssl_url', [ - 'type' => 'text', - 'size' => 35, - 'maxlength' => 255, - 'disabled' => !$isWritableEnv] - ) ?> [SSL]
- +
BcAdminForm->error('site_url') ?> - BcAdminForm->error('ssl_url') ?> diff --git a/plugins/bc-installer/src/Command/InstallCommand.php b/plugins/bc-installer/src/Command/InstallCommand.php index 80a01ce311..44b9d9f994 100644 --- a/plugins/bc-installer/src/Command/InstallCommand.php +++ b/plugins/bc-installer/src/Command/InstallCommand.php @@ -186,7 +186,6 @@ public function install(Arguments $args, ConsoleIo $io, array $dbConfig) $service->buildPermissions(); $siteConfigsService = $this->getService(SiteConfigsServiceInterface::class); $siteConfigsService->putEnv('SITE_URL', $siteUrl); - $siteConfigsService->putEnv('SSL_URL', $siteUrl); if ($dbConfig['datasource'] === 'postgres') { $service->BcDatabase->updateSequence(); } diff --git a/plugins/bc-installer/src/Service/Admin/InstallationsAdminService.php b/plugins/bc-installer/src/Service/Admin/InstallationsAdminService.php index 14265b9c0c..65b4dafb3e 100644 --- a/plugins/bc-installer/src/Service/Admin/InstallationsAdminService.php +++ b/plugins/bc-installer/src/Service/Admin/InstallationsAdminService.php @@ -344,7 +344,6 @@ public function initDb(ServerRequest $request): void // SITE_URL更新 $siteConfigsService = $this->getService(SiteConfigsServiceInterface::class); $siteConfigsService->putEnv('SITE_URL', BcUtil::siteUrl()); - $siteConfigsService->putEnv('SSL_URL', BcUtil::siteUrl()); // シーケンスを更新する $dbConfig = ConnectionManager::getConfig('default'); diff --git a/plugins/bc-mail/src/Model/Table/MailContentsTable.php b/plugins/bc-mail/src/Model/Table/MailContentsTable.php index 806b4c9167..3a7d16c538 100755 --- a/plugins/bc-mail/src/Model/Table/MailContentsTable.php +++ b/plugins/bc-mail/src/Model/Table/MailContentsTable.php @@ -178,35 +178,9 @@ public function validationDefault(Validator $validator): Validator 'message' => __d('baser_core', 'BCC用送信先メールアドレスのEメールの形式が不正です。') ]]); - // ssl_on - $validator - ->add('ssl_on', [ - 'checkSslUrl' => [ - 'rule' => 'checkSslUrl', - 'provider' => 'table', - 'message' => __d('baser_core', 'SSL通信を利用するには、システム設定で、事前にSSL通信用のWebサイトURLを指定してください。') - ]]); - return $validator; } - /** - * SSL用のURLが設定されているかチェックする - * - * @param array $check チェック対象文字列 - * @return boolean - * @checked - * @noTodo - * @unitTest - */ - public function checkSslUrl($value) - { - if ($value && !Configure::read('BcEnv.sslUrl')) { - return false; - } - return true; - } - /** * 英数チェック * diff --git a/plugins/bc-mail/tests/TestCase/Model/Table/MailContentsTableTest.php b/plugins/bc-mail/tests/TestCase/Model/Table/MailContentsTableTest.php index cc152f1c1d..7fff124be7 100755 --- a/plugins/bc-mail/tests/TestCase/Model/Table/MailContentsTableTest.php +++ b/plugins/bc-mail/tests/TestCase/Model/Table/MailContentsTableTest.php @@ -144,27 +144,6 @@ public function testInputTypeErrors() $this->assertEquals('リダイレクトURLはURLの形式を入力してください。', current($errors['redirect_url'])); } - public function testSSLTrue() - { - Configure::write('BcEnv.sslUrl', 'on'); - $validator = $this->MailContent->getValidator('default'); - $errors = $validator->validate([ - 'ssl_on' => ['on'], - ]); - $this->assertCount(0, $errors); - } - - public function testSSLFalse() - { - Configure::write('BcEnv.sslUrl', ''); - $validator = $this->MailContent->getValidator('default'); - $errors = $validator->validate([ - 'ssl_on' => ['on'], - ]); - - $this->assertEquals('SSL通信を利用するには、システム設定で、事前にSSL通信用のWebサイトURLを指定してください。', current($errors['ssl_on'])); - } - public function testURLErrors() { //エラーテスト @@ -199,25 +178,6 @@ public function testURLErrors() $this->assertCount(0, $errors); } - /** - * SSL用のURLが設定されているかチェックする - * @dataProvider checkSslUrlProvider - */ - public function testCheckSslUrl($expected, $sslUrl, $value) - { - Configure::write('BcEnv.sslUrl', $sslUrl); - $this->assertEquals($expected, $this->MailContent->checkSslUrl($value)); - } - - public static function checkSslUrlProvider() - { - return [ - [true, true, 'https://example.com/'], - [false, false, 'https://example.com/'], - [true, false, null], - ]; - } - /** * 英数チェック * @dataProvider alphaNumericDataProvider