Skip to content

Commit

Permalink
Avoid request params to use rendering HTML fc2blog#338
Browse files Browse the repository at this point in the history
  • Loading branch information
uzulla committed Aug 8, 2021
1 parent f5a990a commit d84abbd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion app/src/Web/Controller/Admin/BlogPluginsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,15 @@ public function edit(Request $request): string
$this->set('device_type_sp', (string)App::DEVICE_SP);

// 編集対象のデータ取得、なければリダイレクト
if (!$blog_plugin = $blog_plugins_model->findByIdAndBlogId($id, $blog_id)) {
$blog_plugin = $blog_plugins_model->findByIdAndBlogId($id, $blog_id);
if ($blog_plugin === false) {
$this->redirect($request, array('action' => 'index'));
}

// 初期表示時に編集データの設定
if (!$request->get('blog_plugin') || !$request->isValidSig()) {
$request->set('blog_plugin', $blog_plugin);
$this->set('blog_plugin', $blog_plugin);
return "admin/blog_plugins/edit.twig";
}

Expand Down
2 changes: 1 addition & 1 deletion app/twig_templates/admin/blog_plugins/edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<form action="edit" method="post" id="sys-blog-plugin-form" class="admin-form">

<input type="hidden" name="id" value="{{ req.get('id') }}"/>
<input type="hidden" name="id" value="{{ blog_plugin.id }}"/>
{{ input(req, 'blog_plugin[device_type]', 'hidden') }}
{{ input(req, 'blog_plugin[category]', 'hidden') }}
<input type="hidden" name="sig" value="{{ sig }}"/>
Expand Down
2 changes: 1 addition & 1 deletion app/twig_templates/admin/blog_plugins/edit_sp.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<form action="edit" method="post" id="sys-blog-plugin-form" class="admin-form">

<input type="hidden" name="id" value="{{ req.get('id') }}"/>
<input type="hidden" name="id" value="{{ blog_plugin.id }}"/>
{{ input(req, 'blog_plugin[device_type]', 'hidden') }}
{{ input(req, 'blog_plugin[category]', 'hidden') }}
<input type="hidden" name="sig" value="{{ sig }}"/>
Expand Down

0 comments on commit d84abbd

Please sign in to comment.