Issues (2687)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/Eccube/Form/Type/Admin/PaymentRegisterType.php (1 issue)

Upgrade to new PHP Analysis Engine

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)
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) {
0 ignored issues
show
Deprecated Code introduced by
The constant Symfony\Component\Form\FormEvents::POST_BIND has been deprecated with message: since version 2.3, to be removed in 3.0. Use {@link POST_SUBMIT} instead.

This class constant has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the constant will be removed from the class and what other constant to use instead.

Loading history...
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