@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | |
13 | 13 | # Check for demo mode |
14 | 14 | |
15 | - if (Informer::isDemoMode()) return 'DEMO_MODE_RESTRICTION'; |
|
15 | + if (Informer::isDemoMode()) { |
|
16 | + return 'DEMO_MODE_RESTRICTION'; |
|
17 | + } |
|
16 | 18 | |
17 | 19 | # Define errors list |
18 | 20 | |
@@ -25,12 +27,16 @@ discard block |
||
25 | 27 | |
26 | 28 | foreach ($post as $name => $value) { |
27 | 29 | |
28 | - if (!Settings::set($name, $value)) return (isset($errors[$name]) ? $errors[$name] : false); |
|
30 | + if (!Settings::set($name, $value)) { |
|
31 | + return (isset($errors[$name]) ? $errors[$name] : false); |
|
32 | + } |
|
29 | 33 | } |
30 | 34 | |
31 | 35 | # Save settings |
32 | 36 | |
33 | - if (!Settings::save()) return 'SETTINGS_ERROR_SAVE'; |
|
37 | + if (!Settings::save()) { |
|
38 | + return 'SETTINGS_ERROR_SAVE'; |
|
39 | + } |
|
34 | 40 | |
35 | 41 | # ------------------------ |
36 | 42 |
@@ -40,7 +40,9 @@ |
||
40 | 40 | |
41 | 41 | # Display success message |
42 | 42 | |
43 | - if (false !== Request::get('submitted')) Messages::success(Language::get('SETTINGS_SUCCESS')); |
|
43 | + if (false !== Request::get('submitted')) { |
|
44 | + Messages::success(Language::get('SETTINGS_SUCCESS')); |
|
45 | + } |
|
44 | 46 | |
45 | 47 | # ------------------------ |
46 | 48 |
@@ -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 |
@@ -50,7 +50,9 @@ |
||
50 | 50 | |
51 | 51 | # Display success message |
52 | 52 | |
53 | - if (false !== Request::get('submitted')) Messages::success(Language::get('USER_SUCCESS_EDIT')); |
|
53 | + if (false !== Request::get('submitted')) { |
|
54 | + Messages::success(Language::get('USER_SUCCESS_EDIT')); |
|
55 | + } |
|
54 | 56 | |
55 | 57 | # ------------------------ |
56 | 58 |
@@ -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 |
@@ -23,15 +23,19 @@ discard block |
||
23 | 23 | |
24 | 24 | while (false !== ($name = readdir($handler))) { |
25 | 25 | |
26 | - if (in_array($name, ['.', '..', '.empty'], true)) continue; |
|
26 | + if (in_array($name, ['.', '..', '.empty'], true)) { |
|
27 | + continue; |
|
28 | + } |
|
27 | 29 | |
28 | 30 | $path = ($prefix . $name); $path_full = ($this->parent->pathFull() . $name); |
29 | 31 | |
30 | 32 | $data = ['name' => $name, 'path' => $path, 'path_full' => $path_full]; |
31 | 33 | |
32 | - if (@is_dir($path_full)) $dirs[] = array_merge($data, ['type' => FILEMANAGER_TYPE_DIR]); |
|
33 | - |
|
34 | - else if (@is_file($path_full)) $files[] = array_merge($data, ['type' => FILEMANAGER_TYPE_FILE]); |
|
34 | + if (@is_dir($path_full)) { |
|
35 | + $dirs[] = array_merge($data, ['type' => FILEMANAGER_TYPE_DIR]); |
|
36 | + } else if (@is_file($path_full)) { |
|
37 | + $files[] = array_merge($data, ['type' => FILEMANAGER_TYPE_FILE]); |
|
38 | + } |
|
35 | 39 | } |
36 | 40 | |
37 | 41 | closedir($handler); |
@@ -98,9 +102,11 @@ discard block |
||
98 | 102 | |
99 | 103 | foreach ($this->items['list'] as $item) { |
100 | 104 | |
101 | - if ($item['type'] === FILEMANAGER_TYPE_DIR) $items->add($this->getDirItemBlock($item)); |
|
102 | - |
|
103 | - else if ($item['type'] === FILEMANAGER_TYPE_FILE) $items->add($this->getFileItemBlock($item)); |
|
105 | + if ($item['type'] === FILEMANAGER_TYPE_DIR) { |
|
106 | + $items->add($this->getDirItemBlock($item)); |
|
107 | + } else if ($item['type'] === FILEMANAGER_TYPE_FILE) { |
|
108 | + $items->add($this->getFileItemBlock($item)); |
|
109 | + } |
|
104 | 110 | } |
105 | 111 | |
106 | 112 | # ------------------------ |
@@ -149,7 +155,9 @@ discard block |
||
149 | 155 | |
150 | 156 | $items = $this->getItemsBlock(); |
151 | 157 | |
152 | - if ($items->count() > 0) $contents->items = $items; |
|
158 | + if ($items->count() > 0) { |
|
159 | + $contents->items = $items; |
|
160 | + } |
|
153 | 161 | |
154 | 162 | # Set pagination |
155 | 163 |
@@ -2,8 +2,15 @@ |
||
2 | 2 | |
3 | 3 | namespace Modules\Filemanager\Handler { |
4 | 4 | |
5 | - use Modules\Filemanager, Utils\Messages, Utils\Pagination, Utils\Uploader, Utils\View; |
|
6 | - use Ajax, Arr, Explorer, Language, Number, Request, Template, Url; |
|
5 | + use Modules\Filemanager; |
|
6 | + use Utils\Pagination; |
|
7 | + use Utils\Uploader; |
|
8 | + use Utils\View; |
|
9 | + use Arr; |
|
10 | + use Number; |
|
11 | + use Request; |
|
12 | + use Template; |
|
13 | + use Url; |
|
7 | 14 | |
8 | 15 | class Listview { |
9 | 16 |
@@ -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 |