@@ -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 | |
@@ -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 | |
@@ -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 | |
@@ -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 | # ------------------------ |
@@ -12,7 +12,9 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | private function getPrototype(string $name) { |
| 14 | 14 | |
| 15 | - if (preg_match('/[\/\\\\]/', $name)) return false; |
|
| 15 | + if (preg_match('/[\/\\\\]/', $name)) { |
|
| 16 | + return false; |
|
| 17 | + } |
|
| 16 | 18 | |
| 17 | 19 | $path = (($this->parent->path() ? ($this->parent->path() . '/') : '') . $name); |
| 18 | 20 | |
@@ -34,11 +36,17 @@ discard block |
||
| 34 | 36 | |
| 35 | 37 | public function init(string $name) { |
| 36 | 38 | |
| 37 | - if (false === ($prototype = $this->getPrototype($name))) return false; |
|
| 39 | + if (false === ($prototype = $this->getPrototype($name))) { |
|
| 40 | + return false; |
|
| 41 | + } |
|
| 38 | 42 | |
| 39 | - if (!Explorer::{static::$checker}($prototype['path_full'])) return false; |
|
| 43 | + if (!Explorer::{static::$checker}($prototype['path_full'])) { |
|
| 44 | + return false; |
|
| 45 | + } |
|
| 40 | 46 | |
| 41 | - foreach ($prototype as $var => $value) $this->$var = $value; |
|
| 47 | + foreach ($prototype as $var => $value) { |
|
| 48 | + $this->$var = $value; |
|
| 49 | + } |
|
| 42 | 50 | |
| 43 | 51 | # ------------------------ |
| 44 | 52 | |
@@ -49,11 +57,17 @@ discard block |
||
| 49 | 57 | |
| 50 | 58 | public function create(string $name) { |
| 51 | 59 | |
| 52 | - if (('' !== $this->name) || (false === ($prototype = $this->getPrototype($name)))) return false; |
|
| 60 | + if (('' !== $this->name) || (false === ($prototype = $this->getPrototype($name)))) { |
|
| 61 | + return false; |
|
| 62 | + } |
|
| 53 | 63 | |
| 54 | - if (!Explorer::{static::$creator}($prototype['path_full'])) return false; |
|
| 64 | + if (!Explorer::{static::$creator}($prototype['path_full'])) { |
|
| 65 | + return false; |
|
| 66 | + } |
|
| 55 | 67 | |
| 56 | - foreach ($prototype as $var => $value) $this->$var = $value; |
|
| 68 | + foreach ($prototype as $var => $value) { |
|
| 69 | + $this->$var = $value; |
|
| 70 | + } |
|
| 57 | 71 | |
| 58 | 72 | # ------------------------ |
| 59 | 73 | |
@@ -64,11 +78,17 @@ discard block |
||
| 64 | 78 | |
| 65 | 79 | public function rename(string $name) { |
| 66 | 80 | |
| 67 | - if (('' === $this->name) || (false === ($prototype = $this->getPrototype($name)))) return false; |
|
| 81 | + if (('' === $this->name) || (false === ($prototype = $this->getPrototype($name)))) { |
|
| 82 | + return false; |
|
| 83 | + } |
|
| 68 | 84 | |
| 69 | - if (!@rename($this->path_full, $prototype['path_full'])) return false; |
|
| 85 | + if (!@rename($this->path_full, $prototype['path_full'])) { |
|
| 86 | + return false; |
|
| 87 | + } |
|
| 70 | 88 | |
| 71 | - foreach ($prototype as $var => $value) $this->$var = $value; |
|
| 89 | + foreach ($prototype as $var => $value) { |
|
| 90 | + $this->$var = $value; |
|
| 91 | + } |
|
| 72 | 92 | |
| 73 | 93 | # ------------------------ |
| 74 | 94 | |
@@ -79,9 +99,13 @@ discard block |
||
| 79 | 99 | |
| 80 | 100 | public function remove() { |
| 81 | 101 | |
| 82 | - if ('' === $this->name) return false; |
|
| 102 | + if ('' === $this->name) { |
|
| 103 | + return false; |
|
| 104 | + } |
|
| 83 | 105 | |
| 84 | - if (!Explorer::{static::$remover}($this->path_full, true)) return false; |
|
| 106 | + if (!Explorer::{static::$remover}($this->path_full, true)) { |
|
| 107 | + return false; |
|
| 108 | + } |
|
| 85 | 109 | |
| 86 | 110 | $this->name = ''; $this->path = ''; $this->path_full = ''; |
| 87 | 111 | |