@@ -35,7 +35,7 @@ |
||
35 | 35 | |
36 | 36 | # Handle form |
37 | 37 | |
38 | - if ($this->form->handle(new Controller)) Request::redirect(INSTALL_PATH . '/contact?submitted'); |
|
38 | + if ($this->form->handle(new Controller)) Request::redirect(INSTALL_PATH.'/contact?submitted'); |
|
39 | 39 | |
40 | 40 | # Display success message |
41 | 41 |
@@ -35,11 +35,15 @@ |
||
35 | 35 | |
36 | 36 | # Handle form |
37 | 37 | |
38 | - if ($this->form->handle(new Controller)) Request::redirect(INSTALL_PATH . '/contact?submitted'); |
|
38 | + if ($this->form->handle(new Controller)) { |
|
39 | + Request::redirect(INSTALL_PATH . '/contact?submitted'); |
|
40 | + } |
|
39 | 41 | |
40 | 42 | # Display success message |
41 | 43 | |
42 | - if (false !== Request::get('submitted')) Messages::set('success', Language::get('CONTACT_SUCCESS_SEND')); |
|
44 | + if (false !== Request::get('submitted')) { |
|
45 | + Messages::set('success', Language::get('CONTACT_SUCCESS_SEND')); |
|
46 | + } |
|
43 | 47 | |
44 | 48 | # ------------------------ |
45 | 49 |
@@ -2,7 +2,11 @@ |
||
2 | 2 | |
3 | 3 | namespace Addons\Contact { |
4 | 4 | |
5 | - use Frames, Modules\Auth, Utils\Messages, Utils\View, Language, Request; |
|
5 | + use Frames; |
|
6 | + use Utils\Messages; |
|
7 | + use Utils\View; |
|
8 | + use Language; |
|
9 | + use Request; |
|
6 | 10 | |
7 | 11 | class Handler extends Frames\Site\Area\Common { |
8 | 12 |
@@ -26,7 +26,7 @@ |
||
26 | 26 | |
27 | 27 | # Send mail |
28 | 28 | |
29 | - $to = Settings::get('system_email'); $subject = (Settings::get('site_title') . ' | Contact form message'); |
|
29 | + $to = Settings::get('system_email'); $subject = (Settings::get('site_title').' | Contact form message'); |
|
30 | 30 | |
31 | 31 | if (!Mailer::send($to, $name, $email, $email, $subject, $message)) return 'CONTACT_ERROR_SEND'; |
32 | 32 |
@@ -20,15 +20,21 @@ |
||
20 | 20 | |
21 | 21 | # Validate values |
22 | 22 | |
23 | - if (false === ($email = Validate::userEmail($email))) return ['email', 'CONTACT_ERROR_EMAIL_INVALID']; |
|
23 | + if (false === ($email = Validate::userEmail($email))) { |
|
24 | + return ['email', 'CONTACT_ERROR_EMAIL_INVALID']; |
|
25 | + } |
|
24 | 26 | |
25 | - if (false === Security::checkCaptcha($captcha)) return ['captcha', 'CONTACT_ERROR_CAPTCHA_INCORRECT']; |
|
27 | + if (false === Security::checkCaptcha($captcha)) { |
|
28 | + return ['captcha', 'CONTACT_ERROR_CAPTCHA_INCORRECT']; |
|
29 | + } |
|
26 | 30 | |
27 | 31 | # Send mail |
28 | 32 | |
29 | 33 | $to = Settings::get('system_email'); $subject = (Settings::get('site_title') . ' | Contact form message'); |
30 | 34 | |
31 | - if (!Mailer::send($to, $name, $email, $email, $subject, $message)) return 'CONTACT_ERROR_SEND'; |
|
35 | + if (!Mailer::send($to, $name, $email, $email, $subject, $message)) { |
|
36 | + return 'CONTACT_ERROR_SEND'; |
|
37 | + } |
|
32 | 38 | |
33 | 39 | # ------------------------ |
34 | 40 |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | # Check auth |
16 | 16 | |
17 | - if (Modules\Auth::check()) Request::redirect(INSTALL_PATH . '/admin'); |
|
17 | + if (Modules\Auth::check()) Request::redirect(INSTALL_PATH.'/admin'); |
|
18 | 18 | |
19 | 19 | # Handle request |
20 | 20 |
@@ -14,11 +14,15 @@ |
||
14 | 14 | |
15 | 15 | # Check auth |
16 | 16 | |
17 | - if (Modules\Auth::check()) Request::redirect(INSTALL_PATH . '/admin'); |
|
17 | + if (Modules\Auth::check()) { |
|
18 | + Request::redirect(INSTALL_PATH . '/admin'); |
|
19 | + } |
|
18 | 20 | |
19 | 21 | # Handle request |
20 | 22 | |
21 | - if (Template::isBlock($result = $this->handle())) return $this->displayPage($result, STATUS_CODE_401); |
|
23 | + if (Template::isBlock($result = $this->handle())) { |
|
24 | + return $this->displayPage($result, STATUS_CODE_401); |
|
25 | + } |
|
22 | 26 | |
23 | 27 | # ------------------------ |
24 | 28 |
@@ -12,7 +12,9 @@ |
||
12 | 12 | |
13 | 13 | # Handle request |
14 | 14 | |
15 | - if (Template::isBlock($result = $this->handle())) return $this->displayPage($result, STATUS_CODE_200); |
|
15 | + if (Template::isBlock($result = $this->handle())) { |
|
16 | + return $this->displayPage($result, STATUS_CODE_200); |
|
17 | + } |
|
16 | 18 | |
17 | 19 | # ------------------------ |
18 | 20 |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | # Check auth |
14 | 14 | |
15 | - if (Modules\Auth::check()) Request::redirect(INSTALL_PATH . '/profile'); |
|
15 | + if (Modules\Auth::check()) Request::redirect(INSTALL_PATH.'/profile'); |
|
16 | 16 | |
17 | 17 | # Handle request |
18 | 18 |
@@ -12,11 +12,15 @@ |
||
12 | 12 | |
13 | 13 | # Check auth |
14 | 14 | |
15 | - if (Modules\Auth::check()) Request::redirect(INSTALL_PATH . '/profile'); |
|
15 | + if (Modules\Auth::check()) { |
|
16 | + Request::redirect(INSTALL_PATH . '/profile'); |
|
17 | + } |
|
16 | 18 | |
17 | 19 | # Handle request |
18 | 20 | |
19 | - if (Template::isBlock($result = $this->handle())) return $this->displayPage($result, STATUS_CODE_401); |
|
21 | + if (Template::isBlock($result = $this->handle())) { |
|
22 | + return $this->displayPage($result, STATUS_CODE_401); |
|
23 | + } |
|
20 | 24 | |
21 | 25 | # ------------------------ |
22 | 26 |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | if (!Modules\Auth::check() || ((false !== Request::get('logout')) && Modules\Auth::logout())) { |
16 | 16 | |
17 | - Request::redirect(INSTALL_PATH . '/profile/login'); |
|
17 | + Request::redirect(INSTALL_PATH.'/profile/login'); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | # Handle request |
@@ -19,9 +19,13 @@ |
||
19 | 19 | |
20 | 20 | # Handle request |
21 | 21 | |
22 | - if (Template::isBlock($result = $this->handle())) return $this->displayPage($result, STATUS_CODE_200); |
|
22 | + if (Template::isBlock($result = $this->handle())) { |
|
23 | + return $this->displayPage($result, STATUS_CODE_200); |
|
24 | + } |
|
23 | 25 | |
24 | - if (Ajax::isResponse($result)) return Ajax::output($result); |
|
26 | + if (Ajax::isResponse($result)) { |
|
27 | + return Ajax::output($result); |
|
28 | + } |
|
25 | 29 | |
26 | 30 | # ------------------------ |
27 | 31 |
@@ -12,7 +12,11 @@ discard block |
||
12 | 12 | |
13 | 13 | $text = Language::get($code); |
14 | 14 | |
15 | - if (!$popup) Messages::set('error', $text); else Popup::set('negative', $text); |
|
15 | + if (!$popup) { |
|
16 | + Messages::set('error', $text); |
|
17 | + } else { |
|
18 | + Popup::set('negative', $text); |
|
19 | + } |
|
16 | 20 | |
17 | 21 | # ------------------------ |
18 | 22 | |
@@ -23,15 +27,21 @@ discard block |
||
23 | 27 | |
24 | 28 | public function handle(callable $callback, bool $popup = false) { |
25 | 29 | |
26 | - if (false === ($post = $this->post())) return false; |
|
30 | + if (false === ($post = $this->post())) { |
|
31 | + return false; |
|
32 | + } |
|
27 | 33 | |
28 | 34 | # Check form for errors |
29 | 35 | |
30 | - if ($this->hasErrors()) return $this->displayError('FORM_ERROR_REQUIRED', $popup); |
|
36 | + if ($this->hasErrors()) { |
|
37 | + return $this->displayError('FORM_ERROR_REQUIRED', $popup); |
|
38 | + } |
|
31 | 39 | |
32 | 40 | # Call controller method |
33 | 41 | |
34 | - if (is_string($result = $callback($post))) return $this->displayError($result, $popup); |
|
42 | + if (is_string($result = $callback($post))) { |
|
43 | + return $this->displayError($result, $popup); |
|
44 | + } |
|
35 | 45 | |
36 | 46 | if (is_array($result)) { $this->getField($result[0])->error = true; return $this->displayError($result[1], $popup); } |
37 | 47 |
@@ -2,7 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace Utils { |
4 | 4 | |
5 | - use Utils\Messages, Utils\Popup, Language; |
|
5 | + use Utils\Messages; |
|
6 | + use Utils\Popup; |
|
7 | + use Language; |
|
6 | 8 | |
7 | 9 | abstract class Form extends \Form { |
8 | 10 |
@@ -10,7 +10,7 @@ |
||
10 | 10 | |
11 | 11 | public static function get(string $name) { |
12 | 12 | |
13 | - $class_name = ('Schemas\\' . $name); |
|
13 | + $class_name = ('Schemas\\'.$name); |
|
14 | 14 | |
15 | 15 | if (!isset(self::$cache[$class_name])) self::$cache[$class_name] = new $class_name; |
16 | 16 |
@@ -12,7 +12,9 @@ |
||
12 | 12 | |
13 | 13 | $class_name = ('Schemas\\' . $name); |
14 | 14 | |
15 | - if (!isset(self::$cache[$class_name])) self::$cache[$class_name] = new $class_name; |
|
15 | + if (!isset(self::$cache[$class_name])) { |
|
16 | + self::$cache[$class_name] = new $class_name; |
|
17 | + } |
|
16 | 18 | |
17 | 19 | # ------------------------ |
18 | 20 |
@@ -14,7 +14,9 @@ |
||
14 | 14 | |
15 | 15 | $selection = ['name', 'value']; $order = ['name' => 'ASC']; |
16 | 16 | |
17 | - if (!(DB::select(TABLE_VARIABLES, $selection, null, $order) && DB::getLast()->status)) return; |
|
17 | + if (!(DB::select(TABLE_VARIABLES, $selection, null, $order) && DB::getLast()->status)) { |
|
18 | + return; |
|
19 | + } |
|
18 | 20 | |
19 | 21 | # Process results |
20 | 22 |