@@ 153-168 (lines=16) @@ | ||
150 | 'help' => 'メーラーバックエンドがSMTPかつSMTP-AUTH使用時のみ指定', |
|
151 | 'required' => false, |
|
152 | )) |
|
153 | ->addEventListener(FormEvents::POST_SUBMIT, function ($event) use($app) { |
|
154 | $form = $event->getForm(); |
|
155 | $data = $form->getData(); |
|
156 | ||
157 | $ips = preg_split("/\R/", $data['admin_allow_hosts'], null, PREG_SPLIT_NO_EMPTY); |
|
158 | ||
159 | foreach($ips as $ip) { |
|
160 | $errors = $app['validator']->validateValue($ip, array( |
|
161 | new Assert\Ip(), |
|
162 | ) |
|
163 | ); |
|
164 | if ($errors->count() != 0) { |
|
165 | $form['admin_allow_hosts']->addError(new FormError($ip . 'はIPv4アドレスではありません。')); |
|
166 | } |
|
167 | } |
|
168 | }) |
|
169 | ; |
|
170 | } |
|
171 |
@@ 72-87 (lines=16) @@ | ||
69 | 'label' => 'SSLを強制', |
|
70 | 'required' => false, |
|
71 | )) |
|
72 | ->addEventListener(FormEvents::POST_SUBMIT, function ($event) use($app) { |
|
73 | $form = $event->getForm(); |
|
74 | $data = $form->getData(); |
|
75 | ||
76 | $ips = preg_split("/\R/", $data['admin_allow_host'], null, PREG_SPLIT_NO_EMPTY); |
|
77 | ||
78 | foreach($ips as $ip) { |
|
79 | $errors = $app['validator']->validateValue($ip, array( |
|
80 | new Assert\Ip(), |
|
81 | ) |
|
82 | ); |
|
83 | if ($errors->count() != 0) { |
|
84 | $form['admin_allow_host']->addError(new FormError($ip . 'はIPv4アドレスではありません。')); |
|
85 | } |
|
86 | } |
|
87 | }) |
|
88 | ; |
|
89 | } |
|
90 |