@@ -41,7 +41,9 @@ discard block |
||
41 | 41 | |
42 | 42 | public static function load(string $file_name) { |
43 | 43 | |
44 | - if (false === ($contents = Explorer::getContents($file_name))) return null; |
|
44 | + if (false === ($contents = Explorer::getContents($file_name))) { |
|
45 | + return null; |
|
46 | + } |
|
45 | 47 | |
46 | 48 | return self::parse($contents); |
47 | 49 | } |
@@ -54,7 +56,9 @@ discard block |
||
54 | 56 | |
55 | 57 | public static function save(string $file_name, $value) { |
56 | 58 | |
57 | - if (false === ($value = self::stringify($value))) return false; |
|
59 | + if (false === ($value = self::stringify($value))) { |
|
60 | + return false; |
|
61 | + } |
|
58 | 62 | |
59 | 63 | return Explorer::putContents($file_name, $value); |
60 | 64 | } |
@@ -2,16 +2,16 @@ |
||
2 | 2 | |
3 | 3 | # Regular expressions |
4 | 4 | |
5 | -define('REGEX_MAP_ITEM_PATH', '/^[a-zA-Z0-9_\-\+\.\,\'\*\(\)\[\]:;!$%~]+$/'); |
|
6 | -define('REGEX_MAP_ITEM_HANDLER', '/^[A-Z][a-zA-Z0-9]*$/'); |
|
5 | +define('REGEX_MAP_ITEM_PATH', '/^[a-zA-Z0-9_\-\+\.\,\'\*\(\)\[\]:;!$%~]+$/'); |
|
6 | +define('REGEX_MAP_ITEM_HANDLER', '/^[A-Z][a-zA-Z0-9]*$/'); |
|
7 | 7 | |
8 | -define('REGEX_ADDON_NAME', '/^[A-Z0-9][a-zA-Z0-9]*$/'); |
|
9 | -define('REGEX_LANGUAGE_NAME', '/^[a-z][a-z]-[A-Z][A-Z]$/'); |
|
10 | -define('REGEX_TEMPLATE_NAME', '/^[A-Z0-9][a-zA-Z0-9]*$/'); |
|
8 | +define('REGEX_ADDON_NAME', '/^[A-Z0-9][a-zA-Z0-9]*$/'); |
|
9 | +define('REGEX_LANGUAGE_NAME', '/^[a-z][a-z]-[A-Z][A-Z]$/'); |
|
10 | +define('REGEX_TEMPLATE_NAME', '/^[A-Z0-9][a-zA-Z0-9]*$/'); |
|
11 | 11 | |
12 | -define('REGEX_USER_AUTH_CODE', '/^[a-zA-Z0-9]{40}$/'); |
|
12 | +define('REGEX_USER_AUTH_CODE', '/^[a-zA-Z0-9]{40}$/'); |
|
13 | 13 | |
14 | -define('REGEX_USER_NAME', '/^(?!_)(?!.*_$)(?!.*_{2,})[a-zA-Z0-9_]+$/'); |
|
15 | -define('REGEX_USER_PASSWORD', '/^.+$/'); |
|
14 | +define('REGEX_USER_NAME', '/^(?!_)(?!.*_$)(?!.*_{2,})[a-zA-Z0-9_]+$/'); |
|
15 | +define('REGEX_USER_PASSWORD', '/^.+$/'); |
|
16 | 16 | |
17 | -define('REGEX_FILE_NAME', '/^[^\/?%*:|"<>\\\]+$/'); |
|
17 | +define('REGEX_FILE_NAME', '/^[^\/?%*:|"<>\\\]+$/'); |
@@ -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 |
@@ -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 | if (null === ($data = Schema::get('System')->load())) { |
16 | 16 | |
17 | - Request::redirect(INSTALL_PATH . '/install.php'); |
|
17 | + Request::redirect(INSTALL_PATH.'/install.php'); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | # Connect to database |
@@ -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 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | |
17 | 17 | if (!Modules\Auth::check() || ((false !== Request::get('logout')) && Modules\Auth::logout())) { |
18 | 18 | |
19 | - Request::redirect(INSTALL_PATH . '/admin/login'); |
|
19 | + Request::redirect(INSTALL_PATH.'/admin/login'); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | # 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 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | private function getLayout(Template\Block $contents) { |
25 | 25 | |
26 | - $layout = View::get('Layouts/' . $this->layout); |
|
26 | + $layout = View::get('Layouts/'.$this->layout); |
|
27 | 27 | |
28 | 28 | # Set menu and user |
29 | 29 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | protected function displayPage(Template\Block $contents, int $status = STATUS_CODE_200) { |
84 | 84 | |
85 | - $page = View::get('Main/' . $this->layout); |
|
85 | + $page = View::get('Main/'.$this->layout); |
|
86 | 86 | |
87 | 87 | # Set language |
88 | 88 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | # Set title |
92 | 92 | |
93 | - $page->title = ((('' !== $this->title) ? (Language::get($this->title) . ' | ') : '') . CADMIUM_NAME); |
|
93 | + $page->title = ((('' !== $this->title) ? (Language::get($this->title).' | ') : '').CADMIUM_NAME); |
|
94 | 94 | |
95 | 95 | # Set layout |
96 | 96 |
@@ -111,7 +111,9 @@ |
||
111 | 111 | |
112 | 112 | $ips = preg_split('/ +/', CONFIG_ADMIN_IP, -1, PREG_SPLIT_NO_EMPTY); |
113 | 113 | |
114 | - if (!in_array(REQUEST_CLIENT_IP, $ips, true)) return Status::error404(); |
|
114 | + if (!in_array(REQUEST_CLIENT_IP, $ips, true)) { |
|
115 | + return Status::error404(); |
|
116 | + } |
|
115 | 117 | } |
116 | 118 | |
117 | 119 | # ------------------------ |
@@ -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 |