This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /* |
||
3 | * This file is part of EC-CUBE |
||
4 | * |
||
5 | * Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved. |
||
6 | * |
||
7 | * http://www.lockon.co.jp/ |
||
8 | * |
||
9 | * This program is free software; you can redistribute it and/or |
||
10 | * modify it under the terms of the GNU General Public License |
||
11 | * as published by the Free Software Foundation; either version 2 |
||
12 | * of the License, or (at your option) any later version. |
||
13 | * |
||
14 | * This program is distributed in the hope that it will be useful, |
||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
17 | * GNU General Public License for more details. |
||
18 | * |
||
19 | * You should have received a copy of the GNU General Public License |
||
20 | * along with this program; if not, write to the Free Software |
||
21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||
22 | */ |
||
23 | |||
24 | |||
25 | namespace Eccube\Controller\Admin\Product; |
||
26 | |||
27 | use Eccube\Application; |
||
28 | use Eccube\Controller\AbstractController; |
||
29 | use Eccube\Event\EccubeEvents; |
||
30 | use Eccube\Event\EventArgs; |
||
31 | use Symfony\Component\HttpFoundation\Request; |
||
32 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
||
33 | |||
34 | class ClassNameController extends AbstractController |
||
35 | { |
||
36 | 5 | public function index(Application $app, Request $request, $id = null) |
|
0 ignored issues
–
show
introduced
by
![]() |
|||
37 | { |
||
38 | 5 | if ($id) { |
|
39 | 1 | $TargetClassName = $app['eccube.repository.class_name']->find($id); |
|
40 | 1 | if (!$TargetClassName) { |
|
41 | 1 | throw new NotFoundHttpException('商品規格が存在しません'); |
|
42 | } |
||
43 | } else { |
||
44 | 4 | $TargetClassName = new \Eccube\Entity\ClassName(); |
|
45 | } |
||
46 | |||
47 | 5 | $builder = $app['form.factory'] |
|
48 | 5 | ->createBuilder('admin_class_name', $TargetClassName); |
|
49 | |||
50 | 5 | $event = new EventArgs( |
|
51 | array( |
||
52 | 5 | 'builder' => $builder, |
|
53 | 5 | 'TargetClassName' => $TargetClassName, |
|
54 | ), |
||
55 | $request |
||
56 | ); |
||
57 | 5 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_PRODUCT_CLASS_NAME_INDEX_INITIALIZE, $event); |
|
58 | |||
59 | 5 | $form = $builder->getForm(); |
|
60 | |||
61 | 5 | if ($request->getMethod() === 'POST') { |
|
62 | 2 | $form->handleRequest($request); |
|
63 | 2 | View Code Duplication | if ($form->isValid()) { |
64 | 2 | log_info('商品規格登録開始', array($id)); |
|
65 | 2 | $status = $app['eccube.repository.class_name']->save($TargetClassName); |
|
66 | |||
67 | 2 | if ($status) { |
|
68 | 2 | log_info('商品規格登録完了', array($id)); |
|
69 | |||
70 | 2 | $event = new EventArgs( |
|
71 | array( |
||
72 | 2 | 'form' => $form, |
|
73 | 2 | 'TargetClassName' => $TargetClassName, |
|
74 | ), |
||
75 | $request |
||
76 | ); |
||
77 | 2 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_PRODUCT_CLASS_NAME_INDEX_COMPLETE, $event); |
|
78 | |||
79 | 2 | $app->addSuccess('admin.class_name.save.complete', 'admin'); |
|
80 | |||
81 | 2 | return $app->redirect($app->url('admin_product_class_name')); |
|
82 | } else { |
||
83 | log_info('商品規格登録エラー', array($id)); |
||
84 | $app->addError('admin.class_name.save.error', 'admin'); |
||
85 | } |
||
86 | } |
||
87 | } |
||
88 | |||
89 | 3 | $ClassNames = $app['eccube.repository.class_name']->getList(); |
|
90 | |||
91 | 3 | return $app->render('Product/class_name.twig', array( |
|
92 | 3 | 'form' => $form->createView(), |
|
93 | 3 | 'ClassNames' => $ClassNames, |
|
94 | 3 | 'TargetClassName' => $TargetClassName, |
|
95 | )); |
||
96 | } |
||
97 | |||
98 | 2 | public function delete(Application $app, Request $request, $id) |
|
0 ignored issues
–
show
|
|||
99 | { |
||
100 | 2 | $this->isTokenValid($app); |
|
101 | |||
102 | 2 | $TargetClassName = $app['eccube.repository.class_name']->find($id); |
|
103 | 2 | if (!$TargetClassName) { |
|
104 | $app->deleteMessage(); |
||
105 | return $app->redirect($app->url('admin_product_class_name')); |
||
106 | } |
||
107 | |||
108 | 2 | log_info('商品規格削除開始', array($id)); |
|
109 | |||
110 | 2 | $status = $app['eccube.repository.class_name']->delete($TargetClassName); |
|
111 | |||
112 | 2 | View Code Duplication | if ($status === true) { |
113 | 2 | log_info('商品規格削除完了', array($id)); |
|
114 | |||
115 | 2 | $event = new EventArgs( |
|
116 | array( |
||
117 | 2 | 'TargetClassName' => $TargetClassName, |
|
118 | ), |
||
119 | $request |
||
120 | ); |
||
121 | 2 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_PRODUCT_CLASS_NAME_DELETE_COMPLETE, $event); |
|
122 | |||
123 | 2 | $app->addSuccess('admin.class_name.delete.complete', 'admin'); |
|
124 | } else { |
||
125 | $app->addError('admin.class_name.delete.error', 'admin'); |
||
126 | } |
||
127 | |||
128 | 2 | return $app->redirect($app->url('admin_product_class_name')); |
|
129 | } |
||
130 | |||
131 | 1 | View Code Duplication | public function moveRank(Application $app, Request $request) |
0 ignored issues
–
show
|
|||
132 | { |
||
133 | 1 | if ($request->isXmlHttpRequest()) { |
|
134 | 1 | $ranks = $request->request->all(); |
|
135 | 1 | foreach ($ranks as $classNameId => $rank) { |
|
136 | 1 | $ClassName = $app['eccube.repository.class_name'] |
|
137 | 1 | ->find($classNameId); |
|
138 | 1 | $ClassName->setRank($rank); |
|
139 | 1 | $app['orm.em']->persist($ClassName); |
|
140 | } |
||
141 | 1 | $app['orm.em']->flush(); |
|
142 | } |
||
143 | 1 | return true; |
|
0 ignored issues
–
show
|
|||
144 | } |
||
145 | } |
||
146 |