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\FormEvents; |
||
31 | use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
||
32 | use Symfony\Component\Validator\Constraints as Assert; |
||
33 | |||
34 | class MainEditType extends AbstractType |
||
35 | { |
||
36 | public $app; |
||
37 | |||
38 | 286 | public function __construct(\Silex\Application $app) |
|
39 | { |
||
40 | 286 | $this->app = $app; |
|
41 | } |
||
42 | |||
43 | /** |
||
44 | * {@inheritdoc} |
||
45 | */ |
||
46 | 1 | public function buildForm(FormBuilderInterface $builder, array $options) |
|
47 | { |
||
48 | 1 | $app = $this->app; |
|
49 | |||
50 | $builder |
||
51 | ->add('name', 'text', array( |
||
52 | 1 | 'label' => '名称', |
|
53 | 1 | 'required' => true, |
|
54 | 'constraints' => array( |
||
55 | new Assert\NotBlank(), |
||
56 | new Assert\Length(array( |
||
57 | 1 | 'max' => $app['config']['stext_len'], |
|
58 | )) |
||
59 | 1 | ) |
|
60 | )) |
||
61 | ->add('url', 'text', array( |
||
62 | 1 | 'label' => 'URL', |
|
63 | 1 | 'required' => true, |
|
64 | 'constraints' => array( |
||
65 | new Assert\NotBlank(), |
||
66 | new Assert\Length(array( |
||
67 | 1 | 'max' => $app['config']['stext_len'], |
|
68 | )), |
||
69 | new Assert\Regex(array( |
||
70 | 'pattern' => '/^([0-9a-zA-Z_\-]+\/?)+(?<!\/)$/', |
||
71 | )), |
||
72 | 1 | ) |
|
73 | )) |
||
74 | ->add('file_name', 'text', array( |
||
75 | 1 | 'label' => 'ファイル名', |
|
76 | 1 | 'required' => true, |
|
77 | 'constraints' => array( |
||
78 | new Assert\NotBlank(), |
||
79 | new Assert\Length(array( |
||
80 | 1 | 'max' => $app['config']['stext_len'], |
|
81 | )), |
||
82 | new Assert\Regex(array( |
||
83 | 'pattern' => '/^([0-9a-zA-Z_\-]+\/?)+$/', |
||
84 | )), |
||
85 | 1 | ) |
|
86 | )) |
||
87 | ->add('tpl_data', 'textarea', array( |
||
88 | 'label' => false, |
||
89 | 'mapped' => false, |
||
90 | 'required' => true, |
||
91 | 'constraints' => array() |
||
92 | )) |
||
93 | ->add('author', 'text', array( |
||
94 | 1 | 'label' => 'author', |
|
95 | 1 | 'required' => false, |
|
96 | 'constraints' => array( |
||
97 | new Assert\Length(array( |
||
98 | 1 | 'max' => $app['config']['stext_len'], |
|
99 | )) |
||
100 | 1 | ) |
|
101 | )) |
||
102 | ->add('description', 'text', array( |
||
103 | 1 | 'label' => 'description', |
|
104 | 1 | 'required' => false, |
|
105 | 'constraints' => array( |
||
106 | new Assert\Length(array( |
||
107 | 1 | 'max' => $app['config']['stext_len'], |
|
108 | )) |
||
109 | 1 | ) |
|
110 | )) |
||
111 | ->add('keyword', 'text', array( |
||
112 | 1 | 'label' => 'keyword', |
|
113 | 1 | 'required' => false, |
|
114 | 'constraints' => array( |
||
115 | new Assert\Length(array( |
||
116 | 1 | 'max' => $app['config']['stext_len'], |
|
117 | )) |
||
118 | 1 | ) |
|
119 | )) |
||
120 | ->add('meta_robots', 'text', array( |
||
121 | 1 | 'label' => 'robots', |
|
122 | 1 | 'required' => false, |
|
123 | 'constraints' => array( |
||
124 | new Assert\Length(array( |
||
125 | 1 | 'max' => $app['config']['stext_len'], |
|
126 | )) |
||
127 | 1 | ) |
|
128 | ))->add('meta_tags', 'textarea', array( |
||
129 | 'label' => '追加metaタグ', |
||
130 | 'required' => false, |
||
131 | 'constraints' => array( |
||
132 | new Assert\Length(array( |
||
133 | 1 | 'max' => $app['config']['lltext_len'], |
|
134 | )) |
||
135 | ) |
||
136 | )) |
||
137 | ->add('DeviceType', 'entity', array( |
||
138 | 'class' => 'Eccube\Entity\Master\DeviceType', |
||
139 | 'property' => 'id', |
||
140 | )) |
||
141 | ->add('id', 'hidden') |
||
142 | View Code Duplication | ->addEventListener(FormEvents::POST_SUBMIT, function($event) use ($app) { |
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
143 | $form = $event->getForm(); |
||
144 | $url = $form['url']->getData(); |
||
145 | $DeviceType = $form['DeviceType']->getData(); |
||
146 | $page_id = $form['id']->getData(); |
||
147 | |||
148 | $qb = $app['orm.em']->createQueryBuilder(); |
||
149 | $qb->select('p') |
||
150 | ->from('Eccube\\Entity\\PageLayout', 'p') |
||
151 | ->where('p.url = :url') |
||
152 | ->setParameter('url', $url) |
||
153 | ->andWhere('p.DeviceType = :DeviceType') |
||
154 | ->setParameter('DeviceType', $DeviceType) |
||
155 | ; |
||
156 | if (is_null($page_id)) { |
||
157 | $qb |
||
158 | ->andWhere('p.id IS NOT NULL'); |
||
159 | } else { |
||
160 | $qb |
||
161 | ->andWhere('p.id <> :page_id') |
||
162 | ->setParameter('page_id', $page_id); |
||
163 | } |
||
164 | |||
165 | $PageLayout = $qb |
||
166 | ->getQuery() |
||
167 | ->getResult(); |
||
168 | if (count($PageLayout) > 0) { |
||
169 | $form['url']->addError(new FormError('※ 同じURLのデータが存在しています。別のURLを入力してください。')); |
||
170 | } |
||
171 | }); |
||
172 | } |
||
173 | |||
174 | /** |
||
175 | * {@inheritdoc} |
||
176 | */ |
||
177 | public function setDefaultOptions(OptionsResolverInterface $resolver) |
||
178 | { |
||
179 | $resolver->setDefaults(array( |
||
180 | 285 | 'data_class' => 'Eccube\Entity\PageLayout', |
|
181 | )); |
||
182 | 285 | } |
|
183 | |||
184 | /** |
||
185 | * {@inheritdoc} |
||
186 | */ |
||
187 | public function getName() |
||
188 | { |
||
189 | return 'main_edit'; |
||
190 | } |
||
191 | } |
||
192 |