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\Mypage; |
||
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 DeliveryController extends AbstractController |
||
35 | { |
||
36 | /** |
||
37 | * お届け先一覧画面. |
||
38 | * |
||
39 | * @param Application $app |
||
40 | * @param Request $request |
||
41 | * @return \Symfony\Component\HttpFoundation\Response |
||
42 | */ |
||
43 | public function index(Application $app, Request $request) |
||
0 ignored issues
–
show
|
|||
44 | { |
||
45 | $Customer = $app['user']; |
||
46 | |||
47 | return $app->render('Mypage/delivery.twig', array( |
||
48 | 'Customer' => $Customer, |
||
49 | )); |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * お届け先編集画面. |
||
54 | * |
||
55 | * @param Application $app |
||
56 | * @param Request $request |
||
57 | * @return \Symfony\Component\HttpFoundation\Response |
||
58 | */ |
||
59 | public function edit(Application $app, Request $request, $id = null) |
||
60 | { |
||
61 | $Customer = $app['user']; |
||
62 | |||
63 | // 配送先住所最大値判定 |
||
64 | // $idが存在する際は、追加処理ではなく、編集の処理ため本ロジックスキップ |
||
65 | View Code Duplication | if (is_null($id)) { |
|
66 | $addressCurrNum = count($Customer->getCustomerAddresses()); |
||
67 | $addressMax = $app['config']['deliv_addr_max']; |
||
68 | if ($addressCurrNum >= $addressMax) { |
||
69 | throw new NotFoundHttpException('お届け先の登録数の上限を超えています'); |
||
70 | } |
||
71 | } |
||
72 | |||
73 | $CustomerAddress = $app['eccube.repository.customer_address']->findOrCreateByCustomerAndId($Customer, $id); |
||
74 | |||
75 | $parentPage = $request->get('parent_page', null); |
||
76 | |||
77 | // 正しい遷移かをチェック |
||
78 | $allowdParents = array( |
||
79 | $app->url('mypage_delivery'), |
||
80 | $app->url('shopping_delivery'), |
||
81 | ); |
||
82 | |||
83 | // 遷移が正しくない場合、デフォルトであるマイページの配送先追加の画面を設定する |
||
84 | if (!in_array($parentPage, $allowdParents)) { |
||
85 | // @deprecated 使用されていないコード |
||
86 | $parentPage = $app->url('mypage_delivery'); |
||
87 | } |
||
88 | |||
89 | $builder = $app['form.factory'] |
||
90 | ->createBuilder('customer_address', $CustomerAddress); |
||
91 | |||
92 | $event = new EventArgs( |
||
93 | array( |
||
94 | 'builder' => $builder, |
||
95 | 'Customer' => $Customer, |
||
96 | 'CustomerAddress' => $CustomerAddress, |
||
97 | ), |
||
98 | $request |
||
99 | ); |
||
100 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_MYPAGE_DELIVERY_EDIT_INITIALIZE, $event); |
||
101 | |||
102 | $form = $builder->getForm(); |
||
103 | $form->handleRequest($request); |
||
104 | |||
105 | if ($form->isSubmitted() && $form->isValid()) { |
||
106 | log_info('お届け先登録開始', array($id)); |
||
107 | |||
108 | $app['orm.em']->persist($CustomerAddress); |
||
109 | $app['orm.em']->flush(); |
||
110 | |||
111 | log_info('お届け先登録完了', array($id)); |
||
112 | |||
113 | $event = new EventArgs( |
||
114 | array( |
||
115 | 'form' => $form, |
||
116 | 'Customer' => $Customer, |
||
117 | 'CustomerAddress' => $CustomerAddress, |
||
118 | ), |
||
119 | $request |
||
120 | ); |
||
121 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_MYPAGE_DELIVERY_EDIT_COMPLETE, $event); |
||
122 | |||
123 | $app->addSuccess('mypage.delivery.add.complete'); |
||
124 | |||
125 | return $app->redirect($app->url('mypage_delivery')); |
||
126 | } |
||
127 | |||
128 | $BaseInfo = $app['eccube.repository.base_info']->get(); |
||
129 | |||
130 | return $app->render('Mypage/delivery_edit.twig', array( |
||
131 | 'form' => $form->createView(), |
||
132 | 'parentPage' => $parentPage, |
||
133 | 'BaseInfo' => $BaseInfo, |
||
134 | )); |
||
135 | } |
||
136 | |||
137 | /** |
||
138 | * お届け先を削除する. |
||
139 | * |
||
140 | * @param Application $app |
||
141 | * @param $id |
||
142 | * @return \Symfony\Component\HttpFoundation\RedirectResponse |
||
143 | */ |
||
144 | public function delete(Application $app, Request $request, $id) |
||
145 | { |
||
146 | $this->isTokenValid($app); |
||
147 | |||
148 | log_info('お届け先削除開始', array($id)); |
||
149 | |||
150 | $Customer = $app['user']; |
||
151 | |||
152 | $status = $app['eccube.repository.customer_address']->deleteByCustomerAndId($Customer, $id); |
||
153 | |||
154 | if ($status) { |
||
155 | $event = new EventArgs( |
||
156 | array( |
||
157 | 'id' => $id, |
||
158 | 'Customer' => $Customer, |
||
159 | ), $request |
||
160 | ); |
||
161 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_MYPAGE_DELIVERY_DELETE_COMPLETE, $event); |
||
162 | |||
163 | $app->addSuccess('mypage.address.delete.complete'); |
||
164 | |||
165 | log_info('お届け先削除完了', array($id)); |
||
166 | |||
167 | } else { |
||
168 | $app->addError('mypage.address.delete.failed'); |
||
169 | |||
170 | log_info('お届け先削除失敗', array($id)); |
||
171 | } |
||
172 | |||
173 | return $app->redirect($app->url('mypage_delivery')); |
||
174 | } |
||
175 | } |
||
176 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.