diff --git a/app/config/fc2_template.php b/app/config/fc2_template.php index 4e3838c4..143688ee 100644 --- a/app/config/fc2_template.php +++ b/app/config/fc2_template.php @@ -111,7 +111,7 @@ ]; $template_vars = [ - '<%server_url>' => '', + '<%server_url>' => '', '<%blog_id>' => '', // タイトルリスト一覧 '<%titlelist_eno>' => '', @@ -189,8 +189,8 @@ '<%topentry_image>' => '\'; ?>', '<%topentry_image_72>' => '\'; ?>', '<%topentry_image_w300>' => '\'; ?>', - '<%topentry_image_url>' => '', - '<%topentry_image_url_760x420>' => '', + '<%topentry_image_url>' => '', + '<%topentry_image_url_760x420>' => '', '<%topentry_comment_num>' => '', // 記事のカテゴリー系 '<%topentry_category_no>' => 'set('is_domain', $is_domain); + $this->set('example_server_name', $request->server['SERVER_NAME'] ?? 'example.jp'); // GDインストール済み確認 $is_gd = function_exists('gd_info'); diff --git a/app/src/Web/Controller/Admin/FilesController.php b/app/src/Web/Controller/Admin/FilesController.php index 08ac5fb2..f9be1a60 100644 --- a/app/src/Web/Controller/Admin/FilesController.php +++ b/app/src/Web/Controller/Admin/FilesController.php @@ -13,7 +13,7 @@ class FilesController extends AdminController { /** - * 一覧表示 + * 一覧表示 /admin/files/upload からPartial読み込み * @param Request $request * @return string */ diff --git a/app/src/Web/Controller/Controller.php b/app/src/Web/Controller/Controller.php index 0f7d8e7e..9d033783 100644 --- a/app/src/Web/Controller/Controller.php +++ b/app/src/Web/Controller/Controller.php @@ -174,8 +174,8 @@ protected function redirect(Request $request, $url, $hash = '', bool $full_url = protected function redirectBack(Request $request, $url, $hash = '') { // 元のURLに戻す - if (!empty($_SERVER['HTTP_REFERER'])) { - $this->redirect($request, $_SERVER['HTTP_REFERER']); + if (!empty($request->server['HTTP_REFERER'])) { + $this->redirect($request, $request->server['HTTP_REFERER']); } // リファラーが取れなければメインへ飛ばす $this->redirect($request, $url, $hash); diff --git a/app/src/Web/Controller/User/EntriesController.php b/app/src/Web/Controller/User/EntriesController.php index 972f357d..e4af3158 100644 --- a/app/src/Web/Controller/User/EntriesController.php +++ b/app/src/Web/Controller/User/EntriesController.php @@ -885,6 +885,7 @@ public function comment_edit(Request $request): string // FC2用のテンプレートで表示 $this->setAreaData(['edit_area']); + $this->set('sub_title', __("Edit a comment")); return $this->getFc2TemplatePath($blog_id); } diff --git a/app/src/Web/Cookie.php b/app/src/Web/Cookie.php index 1e9c865c..2a908a62 100644 --- a/app/src/Web/Cookie.php +++ b/app/src/Web/Cookie.php @@ -13,14 +13,15 @@ class Cookie /** * クッキーから情報を取得する - * @param $key - * @param null $default - * @return mixed|null + * @param Request $request + * @param string $key + * @param ?string $default + * @return mixed */ - public static function get($key, $default = null) + public static function get(Request $request, string $key, $default = null) { - if (isset($_COOKIE[$key])) { - return $_COOKIE[$key]; + if (isset($request->cookie[$key])) { + return $request->cookie[$key]; } return $default; } @@ -106,6 +107,7 @@ public static function set( if(defined("THIS_IS_TEST")){ $request->cookie[$key] = $value; }else{ + $request->cookie[$key] = $value; setcookie( $key, $value, diff --git a/app/src/Web/Html.php b/app/src/Web/Html.php index 6eaad83c..e37a61ef 100644 --- a/app/src/Web/Html.php +++ b/app/src/Web/Html.php @@ -244,9 +244,9 @@ public static function input(Request $request, $name, $type, $attrs = array(), $ return $html; } - public static function getServerUrl() + public static function getServerUrl(Request $request): string { - $url = (empty($_SERVER["HTTPS"])) ? 'http://' : 'https://'; + $url = (isset($request->server["HTTPS"]) && $request->server["HTTPS"] === "on") ? 'http://' : 'https://'; $url .= Config::get('DOMAIN'); return $url; } diff --git a/app/src/Web/Request.php b/app/src/Web/Request.php index e4881009..8b591bcb 100644 --- a/app/src/Web/Request.php +++ b/app/src/Web/Request.php @@ -100,12 +100,12 @@ public function __construct( /** * リファラーを返却 存在しない場合は空文字を返却 + * @return string */ - public static function getReferer() + public function getReferer(): string { - // TODO - if (!empty($_SERVER['HTTP_REFERER'])) { - return $_SERVER['HTTP_REFERER']; + if (isset($this->server['HTTP_REFERER'])) { + return $this->server['HTTP_REFERER']; } return ''; } diff --git a/app/src/Web/Session.php b/app/src/Web/Session.php index d0d2e1f8..ca6ed9b9 100644 --- a/app/src/Web/Session.php +++ b/app/src/Web/Session.php @@ -104,7 +104,7 @@ public static function destroy(Request $request) { $_SESSION = []; $request->session = []; - if (isset($_COOKIE[Config::get('SESSION_NAME')])) { + if (isset($request->cookie[Config::get('SESSION_NAME')])) { Cookie::remove($request, Config::get('SESSION_NAME')); } if (session_status() === PHP_SESSION_ACTIVE) { diff --git a/app/twig_templates/admin/blog_plugins/index.twig b/app/twig_templates/admin/blog_plugins/index.twig index d03d97c6..70bbc4bf 100644 --- a/app/twig_templates/admin/blog_plugins/index.twig +++ b/app/twig_templates/admin/blog_plugins/index.twig @@ -77,7 +77,11 @@ display: $(this).prop('checked') ? 1 : 0, sig: "{{ sig }}" }), - cache: false + cache: false, + error: function (data, status, xhr){ + alert("エラーが発生しました、ページをリロードしてやり直してください。\n" + + "An error occurred, please reload page and try again."); + } }); }); diff --git a/app/twig_templates/admin/categories/ajax_add.twig b/app/twig_templates/admin/categories/ajax_add.twig index 95477bec..13e089a8 100644 --- a/app/twig_templates/admin/categories/ajax_add.twig +++ b/app/twig_templates/admin/categories/ajax_add.twig @@ -1,3 +1,4 @@ +{# include from admin/entries/create #}