@@ -54,6 +54,9 @@ |
||
54 | 54 | |
55 | 55 | # Output contents |
56 | 56 | |
57 | + /** |
|
58 | + * @param string $status |
|
59 | + */ |
|
57 | 60 | public static function output(Template\Asset\Block $block, $status = null) { |
58 | 61 | |
59 | 62 | if ((null === $status) || !Headers::isStatusCode($status)) $status = STATUS_CODE_200; |
@@ -10,18 +10,26 @@ discard block |
||
10 | 10 | |
11 | 11 | public static function global(string $name, string $value = null) { |
12 | 12 | |
13 | - if (null === $value) return (self::$globals[$name] ?? false); |
|
13 | + if (null === $value) { |
|
14 | + return (self::$globals[$name] ?? false); |
|
15 | + } |
|
14 | 16 | |
15 | - if (!isset(self::$globals[$name])) self::$globals[$name] = $value; |
|
17 | + if (!isset(self::$globals[$name])) { |
|
18 | + self::$globals[$name] = $value; |
|
19 | + } |
|
16 | 20 | } |
17 | 21 | |
18 | 22 | # Set/get widget |
19 | 23 | |
20 | 24 | public static function widget(string $name, Template\Asset\Block $block = null) { |
21 | 25 | |
22 | - if (null === $block) return (self::$widgets[$name] ?? false); |
|
26 | + if (null === $block) { |
|
27 | + return (self::$widgets[$name] ?? false); |
|
28 | + } |
|
23 | 29 | |
24 | - if (!isset(self::$widgets[$name])) self::$widgets[$name] = $block; |
|
30 | + if (!isset(self::$widgets[$name])) { |
|
31 | + self::$widgets[$name] = $block; |
|
32 | + } |
|
25 | 33 | } |
26 | 34 | |
27 | 35 | # Create block |
@@ -56,7 +64,9 @@ discard block |
||
56 | 64 | |
57 | 65 | public static function output(Template\Asset\Block $block, $status = null) { |
58 | 66 | |
59 | - if ((null === $status) || !Headers::isStatusCode($status)) $status = STATUS_CODE_200; |
|
67 | + if ((null === $status) || !Headers::isStatusCode($status)) { |
|
68 | + $status = STATUS_CODE_200; |
|
69 | + } |
|
60 | 70 | |
61 | 71 | Headers::nocache(); Headers::status($status); Headers::content(MIME_TYPE_HTML); |
62 | 72 |
@@ -12,7 +12,9 @@ |
||
12 | 12 | |
13 | 13 | # Check installation |
14 | 14 | |
15 | - if (!$this->installed) Request::redirect(INSTALL_PATH . '/install.php'); |
|
15 | + if (!$this->installed) { |
|
16 | + Request::redirect(INSTALL_PATH . '/install.php'); |
|
17 | + } |
|
16 | 18 | |
17 | 19 | # Connect to database |
18 | 20 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | # Check installation |
14 | 14 | |
15 | - if (!$this->installed) Request::redirect(INSTALL_PATH . '/install.php'); |
|
15 | + if (!$this->installed) Request::redirect(INSTALL_PATH.'/install.php'); |
|
16 | 16 | |
17 | 17 | # Connect to database |
18 | 18 | |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | # Determine handler class |
26 | 26 | |
27 | - $class = ((false !== $handler) ? ('Handlers\\' . $handler) : 'Handlers\Site\Page'); |
|
27 | + $class = ((false !== $handler) ? ('Handlers\\'.$handler) : 'Handlers\Site\Page'); |
|
28 | 28 | |
29 | 29 | # ------------------------ |
30 | 30 |
@@ -14,7 +14,9 @@ discard block |
||
14 | 14 | |
15 | 15 | $extensions = ['mysqli', 'mbstring', 'gd', 'simplexml']; |
16 | 16 | |
17 | - foreach ($extensions as $name) self::$requirements[$name] = extension_loaded($name); |
|
17 | + foreach ($extensions as $name) { |
|
18 | + self::$requirements[$name] = extension_loaded($name); |
|
19 | + } |
|
18 | 20 | |
19 | 21 | # Check mod_rewrite |
20 | 22 | |
@@ -24,7 +26,9 @@ discard block |
||
24 | 26 | |
25 | 27 | $writables = ['data' => DIR_SYSTEM_DATA, 'uploads' => DIR_UPLOADS]; |
26 | 28 | |
27 | - foreach ($writables as $name => $dir) self::$requirements[$name] = is_writable($dir); |
|
29 | + foreach ($writables as $name => $dir) { |
|
30 | + self::$requirements[$name] = is_writable($dir); |
|
31 | + } |
|
28 | 32 | |
29 | 33 | # Set checking status |
30 | 34 |
@@ -20,21 +20,19 @@ discard block |
||
20 | 20 | |
21 | 21 | # Connect to DB |
22 | 22 | |
23 | - try { DB::connect($server, $user, $password, $name); } |
|
24 | - |
|
25 | - catch (Exception\DBConnect $error) { return 'INSTALL_ERROR_DATABASE_CONNECT'; } |
|
26 | - |
|
27 | - catch (Exception\DBSelect $error) { return 'INSTALL_ERROR_DATABASE_SELECT'; } |
|
28 | - |
|
29 | - catch (Exception\DBCharset $error) { return 'INSTALL_ERROR_DATABASE_CHARSET'; } |
|
23 | + try { DB::connect($server, $user, $password, $name); } catch (Exception\DBConnect $error) { return 'INSTALL_ERROR_DATABASE_CONNECT'; } catch (Exception\DBSelect $error) { return 'INSTALL_ERROR_DATABASE_SELECT'; } catch (Exception\DBCharset $error) { return 'INSTALL_ERROR_DATABASE_CHARSET'; } |
|
30 | 24 | |
31 | 25 | # Create tables |
32 | 26 | |
33 | - if (!Install\Utils\Tables::create()) return 'INSTALL_ERROR_DATABASE_TABLES_CREATE'; |
|
27 | + if (!Install\Utils\Tables::create()) { |
|
28 | + return 'INSTALL_ERROR_DATABASE_TABLES_CREATE'; |
|
29 | + } |
|
34 | 30 | |
35 | 31 | # Fill tables |
36 | 32 | |
37 | - if (!Install\Utils\Tables::fill()) return 'INSTALL_ERROR_DATABASE_TABLES_FILL'; |
|
33 | + if (!Install\Utils\Tables::fill()) { |
|
34 | + return 'INSTALL_ERROR_DATABASE_TABLES_FILL'; |
|
35 | + } |
|
38 | 36 | |
39 | 37 | # Save system file |
40 | 38 | |
@@ -49,7 +47,9 @@ discard block |
||
49 | 47 | |
50 | 48 | $system_file = (DIR_SYSTEM_DATA . 'System.json'); $system = json_encode($system, JSON_PRETTY_PRINT); |
51 | 49 | |
52 | - if (false === Explorer::save($system_file, $system, true)) return 'INSTALL_ERROR_SYSTEM'; |
|
50 | + if (false === Explorer::save($system_file, $system, true)) { |
|
51 | + return 'INSTALL_ERROR_SYSTEM'; |
|
52 | + } |
|
53 | 53 | |
54 | 54 | # ------------------------ |
55 | 55 |
@@ -47,7 +47,7 @@ |
||
47 | 47 | |
48 | 48 | $system['time'] = REQUEST_TIME; |
49 | 49 | |
50 | - $system_file = (DIR_SYSTEM_DATA . 'System.json'); $system = json_encode($system, JSON_PRETTY_PRINT); |
|
50 | + $system_file = (DIR_SYSTEM_DATA.'System.json'); $system = json_encode($system, JSON_PRETTY_PRINT); |
|
51 | 51 | |
52 | 52 | if (false === Explorer::save($system_file, $system, true)) return 'INSTALL_ERROR_SYSTEM'; |
53 | 53 |
@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | |
13 | 13 | $languages = []; |
14 | 14 | |
15 | - foreach (Extend\Languages::items() as $code => $language) $languages[$code] = $language['title']; |
|
15 | + foreach (Extend\Languages::items() as $code => $language) { |
|
16 | + $languages[$code] = $language['title']; |
|
17 | + } |
|
16 | 18 | |
17 | 19 | # ------------------------ |
18 | 20 | |
@@ -25,7 +27,9 @@ discard block |
||
25 | 27 | |
26 | 28 | $templates = []; |
27 | 29 | |
28 | - foreach (Extend\Templates::items() as $name => $template) $templates[$name] = $template['title']; |
|
30 | + foreach (Extend\Templates::items() as $name => $template) { |
|
31 | + $templates[$name] = $template['title']; |
|
32 | + } |
|
29 | 33 | |
30 | 34 | # ------------------------ |
31 | 35 |
@@ -30,14 +30,18 @@ |
||
30 | 30 | |
31 | 31 | foreach (['full_name', 'city'] as $name) { |
32 | 32 | |
33 | - if ('' === ($text = Auth::user()->$name)) $contents->block($name)->disable(); |
|
34 | - |
|
35 | - else $contents->block($name)->text = $text; |
|
33 | + if ('' === ($text = Auth::user()->$name)) { |
|
34 | + $contents->block($name)->disable(); |
|
35 | + } else { |
|
36 | + $contents->block($name)->text = $text; |
|
37 | + } |
|
36 | 38 | } |
37 | 39 | |
38 | 40 | # Set country |
39 | 41 | |
40 | - if ('' === ($country = Auth::user()->country)) $contents->block('country')->disable(); else { |
|
42 | + if ('' === ($country = Auth::user()->country)) { |
|
43 | + $contents->block('country')->disable(); |
|
44 | + } else { |
|
41 | 45 | |
42 | 46 | $contents->block('country')->code = $country; |
43 | 47 |
@@ -14,9 +14,11 @@ |
||
14 | 14 | |
15 | 15 | # Init user by secret code |
16 | 16 | |
17 | - if (false !== ($code = Auth::secret())) $this->code = $code; |
|
18 | - |
|
19 | - else Request::redirect(INSTALL_PATH . (Auth::admin() ? '/admin' : '/profile') . '/reset'); |
|
17 | + if (false !== ($code = Auth::secret())) { |
|
18 | + $this->code = $code; |
|
19 | + } else { |
|
20 | + Request::redirect(INSTALL_PATH . (Auth::admin() ? '/admin' : '/profile') . '/reset'); |
|
21 | + } |
|
20 | 22 | |
21 | 23 | # Create form |
22 | 24 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | if (false !== ($code = Auth::secret())) $this->code = $code; |
18 | 18 | |
19 | - else Request::redirect(INSTALL_PATH . (Auth::admin() ? '/admin' : '/profile') . '/reset'); |
|
19 | + else Request::redirect(INSTALL_PATH.(Auth::admin() ? '/admin' : '/profile').'/reset'); |
|
20 | 20 | |
21 | 21 | # Create form |
22 | 22 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | if ($this->form->handle(new Auth\Controller\Recover())) { |
28 | 28 | |
29 | - Request::redirect(INSTALL_PATH . (Auth::admin() ? '/admin' : '/profile') . '/login?submitted=recover'); |
|
29 | + Request::redirect(INSTALL_PATH.(Auth::admin() ? '/admin' : '/profile').'/login?submitted=recover'); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | # ------------------------ |
@@ -20,7 +20,9 @@ |
||
20 | 20 | |
21 | 21 | # Implement form |
22 | 22 | |
23 | - if (null !== $this->form) $this->form->implement($contents); |
|
23 | + if (null !== $this->form) { |
|
24 | + $this->form->implement($contents); |
|
25 | + } |
|
24 | 26 | |
25 | 27 | # ------------------------ |
26 | 28 |
@@ -16,7 +16,9 @@ discard block |
||
16 | 16 | |
17 | 17 | $path = implode('/', $scheme); $path_full = (DIR_UPLOADS . (('' !== $path) ? ($path . '/') : '')); |
18 | 18 | |
19 | - if (!Explorer::isDir($path_full)) return; |
|
19 | + if (!Explorer::isDir($path_full)) { |
|
20 | + return; |
|
21 | + } |
|
20 | 22 | |
21 | 23 | $this->scheme = $scheme; $this->path = $path; $this->path_full = $path_full; |
22 | 24 | } |
@@ -27,9 +29,12 @@ discard block |
||
27 | 29 | |
28 | 30 | $scheme = []; $breadcrumbs = []; |
29 | 31 | |
30 | - if ([] !== $this->scheme) foreach ($this->scheme as $name) { |
|
32 | + if ([] !== $this->scheme) { |
|
33 | + foreach ($this->scheme as $name) { |
|
31 | 34 | |
32 | - $scheme[] = $name; $breadcrumbs[] = ['path' => implode('/', $scheme), 'name' => $name]; |
|
35 | + $scheme[] = $name; |
|
36 | + } |
|
37 | + $breadcrumbs[] = ['path' => implode('/', $scheme), 'name' => $name]; |
|
33 | 38 | } |
34 | 39 | |
35 | 40 | # ------------------------ |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | $scheme = array_diff(preg_split('/[\/\\\\]+/', $path, -1, PREG_SPLIT_NO_EMPTY), ['.', '..']); |
16 | 16 | |
17 | - $path = implode('/', $scheme); $path_full = (DIR_UPLOADS . (('' !== $path) ? ($path . '/') : '')); |
|
17 | + $path = implode('/', $scheme); $path_full = (DIR_UPLOADS.(('' !== $path) ? ($path.'/') : '')); |
|
18 | 18 | |
19 | 19 | if (!Explorer::isDir($path_full)) return; |
20 | 20 |