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\Form\Type\Admin; |
||
26 | |||
27 | use Symfony\Component\Form\AbstractType; |
||
28 | use Symfony\Component\Form\FormBuilderInterface; |
||
29 | use Symfony\Component\Form\FormError; |
||
30 | use Symfony\Component\Form\FormEvent; |
||
31 | use Symfony\Component\Form\FormEvents; |
||
32 | use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
||
33 | use Symfony\Component\Validator\Constraints as Assert; |
||
34 | |||
35 | class PaymentRegisterType extends AbstractType |
||
36 | { |
||
37 | protected $app; |
||
38 | |||
39 | 663 | public function __construct($app) |
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
40 | { |
||
41 | 663 | $this->app = $app; |
|
42 | } |
||
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | */ |
||
47 | 17 | public function buildForm(FormBuilderInterface $builder, array $options) |
|
48 | { |
||
49 | 17 | $app = $this->app; |
|
50 | |||
51 | $builder |
||
52 | 17 | ->add('method', 'text', array( |
|
53 | 17 | 'label' => '支払方法', |
|
54 | 'required' => true, |
||
55 | 'constraints' => array( |
||
56 | 17 | new Assert\NotBlank(), |
|
57 | ), |
||
58 | )) |
||
59 | 17 | ->add('rule_min', 'money', array( |
|
60 | 17 | 'label' => false, |
|
61 | 17 | 'currency' => 'JPY', |
|
62 | 17 | 'precision' => 0, |
|
63 | 17 | 'scale' => 0, |
|
64 | 'grouping' => true, |
||
65 | 'constraints' => array( |
||
66 | 17 | new Assert\Length(array( |
|
67 | 17 | 'max' => $app['config']['int_len'], |
|
68 | )), |
||
69 | 17 | new Assert\Regex(array( |
|
70 | 17 | 'pattern' => "/^\d+$/u", |
|
71 | 'message' => 'form.type.numeric.invalid' |
||
72 | )), |
||
73 | ), |
||
74 | )) |
||
75 | 17 | ->add('rule_max', 'money', array( |
|
76 | 17 | 'label' => false, |
|
77 | 17 | 'currency' => 'JPY', |
|
78 | 17 | 'precision' => 0, |
|
79 | 17 | 'scale' => 0, |
|
80 | 'grouping' => true, |
||
81 | 'required' => false, |
||
82 | 'constraints' => array( |
||
83 | 17 | new Assert\Length(array( |
|
84 | 17 | 'max' => $app['config']['int_len'], |
|
85 | )), |
||
86 | 17 | new Assert\Regex(array( |
|
87 | 17 | 'pattern' => "/^\d+$/u", |
|
88 | 'message' => 'form.type.numeric.invalid' |
||
89 | )), |
||
90 | ), |
||
91 | )) |
||
92 | 17 | ->add('payment_image_file', 'file', array( |
|
93 | 17 | 'label' => 'ロゴ画像', |
|
94 | 'mapped' => false, |
||
95 | 'required' => false, |
||
96 | )) |
||
97 | 17 | ->add('payment_image', 'hidden', array( |
|
98 | 17 | 'required' => false, |
|
99 | )) |
||
100 | 17 | ->add('charge_flg', 'hidden') |
|
101 | 17 | ->add('fix_flg', 'hidden') |
|
102 | ->addEventListener(FormEvents::POST_BIND, function($event) { |
||
103 | 15 | $form = $event->getForm(); |
|
104 | 15 | $ruleMax = $form['rule_max']->getData(); |
|
105 | 15 | $ruleMin = $form['rule_min']->getData(); |
|
106 | 15 | if (!empty($ruleMin) && !empty($ruleMax) && $ruleMax < $ruleMin) { |
|
107 | 1 | $form['rule_min']->addError(new FormError('利用条件(下限)は'.$ruleMax.'円以下にしてください。')); |
|
108 | } |
||
109 | 17 | }) |
|
110 | 17 | ->addEventListener(FormEvents::POST_SET_DATA, function(FormEvent $event) use ($app) { |
|
111 | 17 | $form = $event->getForm(); |
|
112 | /** @var \Eccube\Entity\Payment $Payment */ |
||
113 | 17 | $Payment = $event->getData(); |
|
114 | 17 | if (is_null($Payment) || $Payment->getChargeFlg() == 1) { |
|
115 | 17 | $form->add('charge', 'money', array( |
|
116 | 17 | 'label' => '手数料', |
|
117 | 17 | 'currency' => 'JPY', |
|
118 | 17 | 'precision' => 0, |
|
119 | 17 | 'scale' => 0, |
|
120 | 'grouping' => true, |
||
121 | 'constraints' => array( |
||
122 | 17 | new Assert\NotBlank(), |
|
123 | 17 | new Assert\Length(array( |
|
124 | 17 | 'max' => $app['config']['int_len'], |
|
125 | )), |
||
126 | 17 | new Assert\Regex(array( |
|
127 | 17 | 'pattern' => "/^\d+$/u", |
|
128 | 'message' => 'form.type.numeric.invalid' |
||
129 | )), |
||
130 | ), |
||
131 | )); |
||
132 | } else { |
||
133 | $form->add('charge', 'hidden'); |
||
134 | } |
||
135 | 17 | }) |
|
136 | ; |
||
137 | } |
||
138 | |||
139 | /** |
||
140 | * {@inheritdoc} |
||
141 | */ |
||
142 | 17 | public function setDefaultOptions(OptionsResolverInterface $resolver) |
|
143 | { |
||
144 | 17 | $resolver->setDefaults(array( |
|
145 | 17 | 'data_class' => 'Eccube\Entity\Payment', |
|
146 | )); |
||
147 | } |
||
148 | |||
149 | /** |
||
150 | * {@inheritdoc} |
||
151 | */ |
||
152 | 663 | public function getName() |
|
153 | { |
||
154 | 663 | return 'payment_register'; |
|
155 | } |
||
156 | } |
||
157 |