diff --git a/app/src/Web/Html.php b/app/src/Web/Html.php index e37a61ef..9442f8ca 100644 --- a/app/src/Web/Html.php +++ b/app/src/Web/Html.php @@ -246,8 +246,9 @@ public static function input(Request $request, $name, $type, $attrs = array(), $ public static function getServerUrl(Request $request): string { - $url = (isset($request->server["HTTPS"]) && $request->server["HTTPS"] === "on") ? 'http://' : 'https://'; + $url = $request->isHttps() ? 'https://' : 'http://'; $url .= Config::get('DOMAIN'); + $url .= $request->isHttps() ? Config::get('HTTPS_PORT_STR') : Config::get('HTTP_PORT_STR'); return $url; } } diff --git a/app/src/Web/Request.php b/app/src/Web/Request.php index 6f73bcd9..399e2d58 100644 --- a/app/src/Web/Request.php +++ b/app/src/Web/Request.php @@ -434,4 +434,9 @@ public function getBlogId(): ?string return null; } } + + public function isHttps(): bool + { + return isset($this->server["HTTPS"]) && $this->server["HTTPS"] === "on"; + } } diff --git a/app/templates/default/fc2_default_template_sp.php b/app/templates/default/fc2_default_template_sp.php index ea1ba814..3fbcfd2c 100644 --- a/app/templates/default/fc2_default_template_sp.php +++ b/app/templates/default/fc2_default_template_sp.php @@ -299,7 +299,7 @@ function submit(){
\r\n<%introduction>
\r\ndiff --git a/tests/test_fixture.sql b/tests/test_fixture.sql index 849d152d..9057aef2 100644 --- a/tests/test_fixture.sql +++ b/tests/test_fixture.sql @@ -54,14 +54,14 @@ UNLOCK TABLES; LOCK TABLES `blog_templates` WRITE; /*!40000 ALTER TABLE `blog_templates` DISABLE KEYS */; -INSERT INTO `blog_templates` (`id`, `blog_id`, `template_id`, `title`, `html`, `css`, `device_type`, `created_at`, `updated_at`) VALUES (1,'testblog1',0,'初期テンプレート','\r\n\" lang=\"<%template_language>\">\r\n
\r\n\" />\r\n\r\n\r\n\r\n\" />\r\n\" />\r\n
\r\n\r\n\" media=\"all\" />\r\n?xml\" title=\"RSS\" />\r\n\" title=\"Top\" />\r\n?all\" title=\"<%template_index>\" />\r\n\" title=\"<%template_prevpage>\" />\r\n\" title=\"<%template_nextpage>\" />\r\n\" title=\"<%preventry_title>\" />\r\n\" title=\"<%nextentry_title>\" />\r\n\r\n\r\n\r\n
\r\n