These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | namespace Redaxscript\View; |
||
3 | |||
4 | use Redaxscript\Html; |
||
5 | use Redaxscript\Module; |
||
6 | use Redaxscript\Validator; |
||
7 | |||
8 | /** |
||
9 | * children class to create the install form |
||
10 | * |
||
11 | * @since 3.0.0 |
||
12 | * |
||
13 | * @package Redaxscript |
||
14 | * @category View |
||
15 | * @author Henry Ruhs |
||
16 | */ |
||
17 | |||
18 | class InstallForm extends ViewAbstract |
||
19 | { |
||
20 | /** |
||
21 | * render the view |
||
22 | * |
||
23 | * @param array $installArray |
||
24 | * |
||
25 | * @since 3.0.0 |
||
26 | * |
||
27 | * @return string |
||
28 | */ |
||
29 | |||
30 | 1 | public function render(array $installArray = []) : string |
|
31 | { |
||
32 | 1 | $output = Module\Hook::trigger('installFormStart'); |
|
33 | 1 | $nameValidator = new Validator\Name(); |
|
34 | 1 | $userValidator = new Validator\User(); |
|
35 | 1 | $passwordValidator = new Validator\Password(); |
|
36 | |||
37 | /* html element */ |
||
38 | |||
39 | 1 | $titleElement = new Html\Element(); |
|
40 | $titleElement |
||
41 | 1 | ->init('h2', |
|
42 | [ |
||
43 | 1 | 'class' => 'rs-title-content' |
|
44 | ]) |
||
45 | 1 | ->text($this->_language->get('installation')); |
|
46 | 1 | $formElement = new Html\Form($this->_registry, $this->_language); |
|
47 | 1 | $formElement->init( |
|
48 | [ |
||
49 | 1 | 'form' => |
|
50 | [ |
||
51 | 'class' => 'rs-js-validate rs-js-behavior rs-component-accordion rs-form-default rs-form-install' |
||
52 | ], |
||
53 | 'button' => |
||
54 | [ |
||
55 | 'submit' => |
||
56 | [ |
||
57 | 'class' => 'rs-js-submit rs-button-default rs-is-full', |
||
58 | 'name' => self::class |
||
59 | ] |
||
60 | ] |
||
61 | ]); |
||
62 | |||
63 | /* create the form */ |
||
64 | |||
65 | $formElement |
||
66 | |||
67 | /* database */ |
||
68 | |||
69 | 1 | ->radio( |
|
70 | [ |
||
71 | 1 | 'id' => self::class . '\Database', |
|
72 | 'class' => 'rs-fn-status-accordion', |
||
73 | 'name' => self::class . '\Accordion', |
||
74 | 'checked' => 'checked' |
||
75 | ]) |
||
76 | 1 | ->label($this->_language->get('database_setup'), |
|
77 | [ |
||
78 | 1 | 'class' => 'rs-fn-toggle-accordion rs-label-accordion', |
|
79 | 'for' => self::class . '\Database' |
||
80 | ]) |
||
81 | 1 | ->append('<ul class="rs-fn-content-accordion rs-box-accordion"><li>') |
|
82 | 1 | ->label($this->_language->get('type'), |
|
83 | [ |
||
84 | 'for' => 'db-type' |
||
85 | 1 | ]) |
|
86 | 1 | ->select($this->_registry->get('driverArray'), |
|
0 ignored issues
–
show
|
|||
87 | [ |
||
88 | 1 | $installArray['dbType'] |
|
89 | ], |
||
90 | 1 | $this->_registry->get('driverArray') ? |
|
91 | [ |
||
92 | 1 | 'id' => 'db-type', |
|
93 | 'name' => 'db-type' |
||
94 | ] : |
||
95 | 1 | [ |
|
96 | 'id' => 'db-type', |
||
97 | 'name' => 'db-type', |
||
98 | 1 | 'disabled' => 'disabled' |
|
99 | ]) |
||
100 | ->append('</li><li>') |
||
101 | 1 | ->label($this->_language->get('host'), |
|
102 | 1 | [ |
|
103 | 'for' => 'db-host' |
||
104 | 1 | ]) |
|
105 | ->text( |
||
106 | 1 | [ |
|
107 | 'id' => 'db-host', |
||
108 | 1 | 'name' => 'db-host', |
|
109 | 1 | 'required' => 'required', |
|
110 | 1 | 'value' => $installArray['dbHost'] |
|
111 | 1 | ]) |
|
112 | ->append('</li><li>') |
||
113 | 1 | ->label($this->_language->get('name'), |
|
114 | 1 | [ |
|
115 | 'for' => 'db-name' |
||
116 | 1 | ]) |
|
117 | ->text( |
||
118 | 1 | [ |
|
119 | 'id' => 'db-name', |
||
120 | 1 | 'name' => 'db-name', |
|
121 | 1 | 'required' => 'required', |
|
122 | 1 | 'value' => $installArray['dbName'] |
|
123 | 1 | ]) |
|
124 | ->append('</li><li>') |
||
125 | 1 | ->label($this->_language->get('user'), |
|
126 | 1 | [ |
|
127 | 'for' => 'db-user' |
||
128 | 1 | ]) |
|
129 | ->text( |
||
130 | 1 | [ |
|
131 | 'id' => 'db-user', |
||
132 | 1 | 'name' => 'db-user', |
|
133 | 1 | 'required' => 'required', |
|
134 | 1 | 'value' => $installArray['dbUser'] |
|
135 | 1 | ]) |
|
136 | ->append('</li><li>') |
||
137 | 1 | ->label($this->_language->get('password'), |
|
138 | 1 | [ |
|
139 | 'for' => 'db-password' |
||
140 | 1 | ]) |
|
141 | ->password( |
||
142 | 1 | [ |
|
143 | 'id' => 'db-password', |
||
144 | 1 | 'name' => 'db-password', |
|
145 | 1 | 'value' => $installArray['dbPassword'] |
|
146 | 1 | ]) |
|
147 | ->append('</li><li>') |
||
148 | 1 | ->label($this->_language->get('prefix'), |
|
149 | 1 | [ |
|
150 | 'for' => 'db-prefix' |
||
151 | 1 | ]) |
|
152 | ->text( |
||
153 | 1 | [ |
|
154 | 'id' => 'db-prefix', |
||
155 | 1 | 'name' => 'db-prefix', |
|
156 | 1 | 'value' => $installArray['dbPrefix'] |
|
157 | 1 | ]) |
|
158 | ->append('</li></ul>') |
||
159 | 1 | ||
160 | /* account */ |
||
161 | |||
162 | ->radio( |
||
163 | 1 | [ |
|
164 | 'id' => self::class . '\Account', |
||
165 | 1 | 'class' => 'rs-fn-status-accordion', |
|
166 | 'name' => self::class . '\Accordion' |
||
167 | ]) |
||
168 | ->label($this->_language->get('account_create'), |
||
169 | 1 | [ |
|
170 | 'class' => 'rs-fn-toggle-accordion rs-label-accordion', |
||
171 | 1 | 'for' => self::class . '\Account' |
|
172 | ]) |
||
173 | ->append('<ul class="rs-fn-content-accordion rs-box-accordion"><li>') |
||
174 | 1 | ->label($this->_language->get('name'), |
|
175 | 1 | [ |
|
176 | 'for' => 'name' |
||
177 | 1 | ]) |
|
178 | ->text( |
||
179 | 1 | [ |
|
180 | 'id' => 'admin-name', |
||
181 | 1 | 'name' => 'admin-name', |
|
182 | 1 | 'pattern' => $nameValidator->getPattern(), |
|
183 | 1 | 'required' => 'required', |
|
184 | 1 | 'value' => $installArray['adminName'] |
|
185 | 1 | ]) |
|
186 | ->append('</li><li>') |
||
187 | 1 | ->label($this->_language->get('user'), |
|
188 | 1 | [ |
|
189 | 'for' => 'admin-user' |
||
190 | 1 | ]) |
|
191 | ->text( |
||
192 | 1 | [ |
|
193 | 'id' => 'admin-user', |
||
194 | 1 | 'name' => 'admin-user', |
|
195 | 1 | 'pattern' => $userValidator->getPattern(), |
|
196 | 1 | 'required' => 'required', |
|
197 | 1 | 'value' => $installArray['adminUser'] |
|
198 | 1 | ]) |
|
199 | ->append('</li><li>') |
||
200 | 1 | ->label($this->_language->get('password'), |
|
201 | 1 | [ |
|
202 | 'for' => 'admin-password' |
||
203 | 1 | ]) |
|
204 | ->password( |
||
205 | 1 | [ |
|
206 | 'id' => 'admin-password', |
||
207 | 1 | 'name' => 'admin-password', |
|
208 | 1 | 'pattern' => $passwordValidator->getPattern(), |
|
209 | 1 | 'required' => 'required', |
|
210 | 1 | 'value' => $installArray['adminPassword'] |
|
211 | 1 | ]) |
|
212 | ->append('</li><li>') |
||
213 | 1 | ->label($this->_language->get('email'), |
|
214 | 1 | [ |
|
215 | 'for' => 'admin-email' |
||
216 | 1 | ]) |
|
217 | ->email( |
||
218 | 1 | [ |
|
219 | 'id' => 'admin-email', |
||
220 | 1 | 'name' => 'admin-email', |
|
221 | 1 | 'required' => 'required', |
|
222 | 1 | 'value' => $installArray['adminEmail'] |
|
223 | 1 | ]) |
|
224 | ->append('</li></ul>') |
||
225 | 1 | ->hidden( |
|
226 | 1 | [ |
|
227 | 'name' => 'refresh-connection', |
||
228 | 1 | 'value' => 1 |
|
229 | ]) |
||
230 | ->token() |
||
231 | 1 | ->submit($this->_language->get('install')); |
|
232 | 1 | ||
233 | /* collect output */ |
||
234 | |||
235 | $output .= $titleElement . $formElement; |
||
236 | 1 | $output .= Module\Hook::trigger('installFormEnd'); |
|
237 | 1 | return $output; |
|
238 | 1 | } |
|
239 | } |
||
240 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.