@@ -130,7 +130,8 @@ discard block |
||
130 | 130 | return $sql; |
131 | 131 | } |
132 | 132 | |
133 | - private function gender($gender, $sql, $wheres) { |
|
133 | + private function gender($gender, $sql, $wheres) |
|
134 | + { |
|
134 | 135 | if ($gender) { |
135 | 136 | $sql .= 'gender = ? AND '; |
136 | 137 | array_push($wheres, $gender); |
@@ -138,7 +139,8 @@ discard block |
||
138 | 139 | return [$sql, $wheres]; |
139 | 140 | } |
140 | 141 | |
141 | - private function zip($zip, $sql, $wheres) { |
|
142 | + private function zip($zip, $sql, $wheres) |
|
143 | + { |
|
142 | 144 | if ($zip) { |
143 | 145 | $sql .= 'zip = ? AND '; |
144 | 146 | array_push($wheres, $zip); |
@@ -146,7 +148,8 @@ discard block |
||
146 | 148 | return [$sql, $wheres]; |
147 | 149 | } |
148 | 150 | |
149 | - private function country($country, $sql, $wheres) { |
|
151 | + private function country($country, $sql, $wheres) |
|
152 | + { |
|
150 | 153 | if ($country) { |
151 | 154 | $sql .= 'country = ? AND '; |
152 | 155 | array_push($wheres, $country); |
@@ -154,7 +157,8 @@ discard block |
||
154 | 157 | return [$sql, $wheres]; |
155 | 158 | } |
156 | 159 | |
157 | - private function registration($registration_from, $registration_to, $sql, $wheres) { |
|
160 | + private function registration($registration_from, $registration_to, $sql, $wheres) |
|
161 | + { |
|
158 | 162 | if ($registration_from) { |
159 | 163 | $registration_from = date("Y-m-d", strtotime($registration_from)); |
160 | 164 |
@@ -90,7 +90,7 @@ |
||
90 | 90 | 'house_number' => $posts['house_number'], |
91 | 91 | 'additional' => $posts['additional'], |
92 | 92 | ]; |
93 | - foreach($array as $key => $value) { |
|
93 | + foreach ($array as $key => $value) { |
|
94 | 94 | if (!$value) { |
95 | 95 | $value = null; |
96 | 96 | } |
@@ -75,7 +75,9 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function require($call = true, $msg = null) |
77 | 77 | { |
78 | - if ($call === false) return $this; |
|
78 | + if ($call === false) { |
|
79 | + return $this; |
|
80 | + } |
|
79 | 81 | |
80 | 82 | $value = $this->value(); |
81 | 83 | |
@@ -107,11 +109,15 @@ discard block |
||
107 | 109 | */ |
108 | 110 | public function email($call = true, $msg = null) |
109 | 111 | { |
110 | - if ($call === false) return $this; |
|
112 | + if ($call === false) { |
|
113 | + return $this; |
|
114 | + } |
|
111 | 115 | |
112 | 116 | $value = $this->value(); |
113 | 117 | |
114 | - if (!$value && $value != '0') return $this; |
|
118 | + if (!$value && $value != '0') { |
|
119 | + return $this; |
|
120 | + } |
|
115 | 121 | |
116 | 122 | if (!filter_var($value, FILTER_VALIDATE_EMAIL)) { |
117 | 123 | $msg = $msg ?: 'e-mail is not valid'; |
@@ -130,11 +136,15 @@ discard block |
||
130 | 136 | */ |
131 | 137 | public function image($call = true, $msg = null) |
132 | 138 | { |
133 | - if ($call === false) return $this; |
|
139 | + if ($call === false) { |
|
140 | + return $this; |
|
141 | + } |
|
134 | 142 | |
135 | 143 | $file = $this->app->request->file($this->input); |
136 | 144 | |
137 | - if (!$file->exists()) return $this; |
|
145 | + if (!$file->exists()) { |
|
146 | + return $this; |
|
147 | + } |
|
138 | 148 | |
139 | 149 | if (!$file->isImage()) { |
140 | 150 | $msg = $msg ?: 'image is not valid'; |
@@ -153,11 +163,15 @@ discard block |
||
153 | 163 | */ |
154 | 164 | public function number($call = true, $msg = null) |
155 | 165 | { |
156 | - if ($call === false) return $this; |
|
166 | + if ($call === false) { |
|
167 | + return $this; |
|
168 | + } |
|
157 | 169 | |
158 | 170 | $value = $this->value(); |
159 | 171 | |
160 | - if (!$value && $value != '0') return $this; |
|
172 | + if (!$value && $value != '0') { |
|
173 | + return $this; |
|
174 | + } |
|
161 | 175 | |
162 | 176 | if (!is_numeric($value)) { |
163 | 177 | $msg = $msg ?: 'this field must be a number'; |
@@ -176,11 +190,15 @@ discard block |
||
176 | 190 | */ |
177 | 191 | public function float($call = true, $msg = null) |
178 | 192 | { |
179 | - if ($call === false) return $this; |
|
193 | + if ($call === false) { |
|
194 | + return $this; |
|
195 | + } |
|
180 | 196 | |
181 | 197 | $value = $this->value(); |
182 | 198 | |
183 | - if (!$value && $value != '0') return $this; |
|
199 | + if (!$value && $value != '0') { |
|
200 | + return $this; |
|
201 | + } |
|
184 | 202 | |
185 | 203 | if (!is_float($value)) { |
186 | 204 | $msg = $msg ?: "this field must be a float number"; |
@@ -201,11 +219,15 @@ discard block |
||
201 | 219 | */ |
202 | 220 | public function date($options = [], $msg = null) |
203 | 221 | { |
204 | - if ($options === false) return $this; |
|
222 | + if ($options === false) { |
|
223 | + return $this; |
|
224 | + } |
|
205 | 225 | |
206 | 226 | $value = $this->value(); |
207 | 227 | |
208 | - if (!$value && $value != '0') return $this; |
|
228 | + if (!$value && $value != '0') { |
|
229 | + return $this; |
|
230 | + } |
|
209 | 231 | |
210 | 232 | $options = json_encode($options); |
211 | 233 | $options = json_decode($options); |
@@ -234,11 +256,15 @@ discard block |
||
234 | 256 | */ |
235 | 257 | public function text($call = true, $msg = null) |
236 | 258 | { |
237 | - if ($call === false) return $this; |
|
259 | + if ($call === false) { |
|
260 | + return $this; |
|
261 | + } |
|
238 | 262 | |
239 | 263 | $value = $this->value(); |
240 | 264 | |
241 | - if (!$value && $value != '0') return $this; |
|
265 | + if (!$value && $value != '0') { |
|
266 | + return $this; |
|
267 | + } |
|
242 | 268 | |
243 | 269 | if (!is_string($value)) { |
244 | 270 | $msg = $msg ?: 'the field must be a text'; |
@@ -257,11 +283,15 @@ discard block |
||
257 | 283 | */ |
258 | 284 | public function noNumbers($call = true, $msg = null) |
259 | 285 | { |
260 | - if ($call === false) return $this; |
|
286 | + if ($call === false) { |
|
287 | + return $this; |
|
288 | + } |
|
261 | 289 | |
262 | 290 | $value = $this->value(); |
263 | 291 | |
264 | - if (!$value && $value != '0') return $this; |
|
292 | + if (!$value && $value != '0') { |
|
293 | + return $this; |
|
294 | + } |
|
265 | 295 | |
266 | 296 | if (preg_match('~[0-9]~', $value)) { |
267 | 297 | $msg = $msg ?: 'numbers are not allow'; |
@@ -280,11 +310,15 @@ discard block |
||
280 | 310 | */ |
281 | 311 | public function characters($excepts, $msg = null) |
282 | 312 | { |
283 | - if ($excepts === false) return $this; |
|
313 | + if ($excepts === false) { |
|
314 | + return $this; |
|
315 | + } |
|
284 | 316 | |
285 | 317 | $value = $this->value(); |
286 | 318 | |
287 | - if (!$value && $value != '0') return $this; |
|
319 | + if (!$value && $value != '0') { |
|
320 | + return $this; |
|
321 | + } |
|
288 | 322 | |
289 | 323 | $characters = new Characters($excepts, $value); |
290 | 324 | |
@@ -315,11 +349,15 @@ discard block |
||
315 | 349 | */ |
316 | 350 | public function noSpaces($call = true, $msg = null) |
317 | 351 | { |
318 | - if ($call === false) return $this; |
|
352 | + if ($call === false) { |
|
353 | + return $this; |
|
354 | + } |
|
319 | 355 | |
320 | 356 | $value = $this->value(); |
321 | 357 | |
322 | - if (!$value && $value != '0') return $this; |
|
358 | + if (!$value && $value != '0') { |
|
359 | + return $this; |
|
360 | + } |
|
323 | 361 | |
324 | 362 | if (preg_match('/\s/', $value)) { |
325 | 363 | $msg = $msg ?: 'spaces are not allow'; |
@@ -338,11 +376,15 @@ discard block |
||
338 | 376 | */ |
339 | 377 | public function alloweJust($characters = [], $msg = null) |
340 | 378 | { |
341 | - if ($characters === false) return $this; |
|
379 | + if ($characters === false) { |
|
380 | + return $this; |
|
381 | + } |
|
342 | 382 | |
343 | 383 | $value = $this->value(); |
344 | 384 | |
345 | - if (!$value && $value != '0') return $this; |
|
385 | + if (!$value && $value != '0') { |
|
386 | + return $this; |
|
387 | + } |
|
346 | 388 | |
347 | 389 | $allowedCharacters = new AlloweJust($this->app, $characters); |
348 | 390 | $characters = $allowedCharacters->getCharacters(); |
@@ -363,11 +405,15 @@ discard block |
||
363 | 405 | */ |
364 | 406 | public function length($length = null, $msg = null) |
365 | 407 | { |
366 | - if ($length === false) return $this; |
|
408 | + if ($length === false) { |
|
409 | + return $this; |
|
410 | + } |
|
367 | 411 | |
368 | 412 | $value = $this->value(); |
369 | 413 | |
370 | - if (!$value && $value != '0') return $this; |
|
414 | + if (!$value && $value != '0') { |
|
415 | + return $this; |
|
416 | + } |
|
371 | 417 | |
372 | 418 | if (strlen($value) !== $length) { |
373 | 419 | $msg = $msg ?: `this field can be just ${length} charachter`; |
@@ -386,11 +432,15 @@ discard block |
||
386 | 432 | */ |
387 | 433 | public function maxLen($length = null, $msg = null) |
388 | 434 | { |
389 | - if ($length === false) return $this; |
|
435 | + if ($length === false) { |
|
436 | + return $this; |
|
437 | + } |
|
390 | 438 | |
391 | 439 | $value = $this->value(); |
392 | 440 | |
393 | - if (!$value && $value != '0') return $this; |
|
441 | + if (!$value && $value != '0') { |
|
442 | + return $this; |
|
443 | + } |
|
394 | 444 | |
395 | 445 | if (strlen($value) > $length) { |
396 | 446 | $msg = $msg ?: "this field can be maximum $length charachter"; |
@@ -409,11 +459,15 @@ discard block |
||
409 | 459 | */ |
410 | 460 | public function minLen($length = null, $msg = null) |
411 | 461 | { |
412 | - if ($length === false) return $this; |
|
462 | + if ($length === false) { |
|
463 | + return $this; |
|
464 | + } |
|
413 | 465 | |
414 | 466 | $value = $this->value(); |
415 | 467 | |
416 | - if (!$value && $value != '0') return $this; |
|
468 | + if (!$value && $value != '0') { |
|
469 | + return $this; |
|
470 | + } |
|
417 | 471 | |
418 | 472 | if (strlen($value) < $length) { |
419 | 473 | $msg = $msg ?: "this field can be minimum $length charachter"; |
@@ -432,7 +486,9 @@ discard block |
||
432 | 486 | */ |
433 | 487 | public function match($input, $msg = null) |
434 | 488 | { |
435 | - if ($input === false) return $this; |
|
489 | + if ($input === false) { |
|
490 | + return $this; |
|
491 | + } |
|
436 | 492 | |
437 | 493 | $value = $this->value(); |
438 | 494 | |
@@ -457,11 +513,15 @@ discard block |
||
457 | 513 | */ |
458 | 514 | public function unique($data = [], $msg = null) |
459 | 515 | { |
460 | - if ($data === false) return $this; |
|
516 | + if ($data === false) { |
|
517 | + return $this; |
|
518 | + } |
|
461 | 519 | |
462 | 520 | $value = $this->value(); |
463 | 521 | |
464 | - if (!$data) return $this; |
|
522 | + if (!$data) { |
|
523 | + return $this; |
|
524 | + } |
|
465 | 525 | |
466 | 526 | if (is_array($data)) { |
467 | 527 | list($table, $column) = $data; |
@@ -519,7 +579,9 @@ discard block |
||
519 | 579 | */ |
520 | 580 | public function addError($input, $msg) |
521 | 581 | { |
522 | - if (!$this->hasError($input)) $this->errors[$input] = $msg; |
|
582 | + if (!$this->hasError($input)) { |
|
583 | + $this->errors[$input] = $msg; |
|
584 | + } |
|
523 | 585 | } |
524 | 586 | |
525 | 587 | /** |
@@ -33,7 +33,9 @@ |
||
33 | 33 | $app->pages->add('not found', '/404', 'fas fa-times'); |
34 | 34 | |
35 | 35 | // == Website's routes |
36 | -if ($app->request->isRequestToAdminManagement()) return; |
|
36 | +if ($app->request->isRequestToAdminManagement()) { |
|
37 | + return; |
|
38 | +} |
|
37 | 39 | |
38 | 40 | |
39 | 41 | $app->route->add('/', 'Website/Home'); |
@@ -2,7 +2,9 @@ |
||
2 | 2 | |
3 | 3 | $app = app(); |
4 | 4 | |
5 | -if (!$app->request->isRequestToAdminManagement()) return; |
|
5 | +if (!$app->request->isRequestToAdminManagement()) { |
|
6 | + return; |
|
7 | +} |
|
6 | 8 | |
7 | 9 | // Rotes admins |
8 | 10 |