@@ -39,7 +39,7 @@ |
||
39 | 39 | |
40 | 40 | if ((0 !== strcasecmp($this->entity->name(), $name)) && |
41 | 41 | |
42 | - @file_exists($this->entity->parent()->pathFull() . $name)) return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
42 | + @file_exists($this->entity->parent()->pathFull().$name)) return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
43 | 43 | |
44 | 44 | # Rename item |
45 | 45 |
@@ -29,23 +29,31 @@ |
||
29 | 29 | |
30 | 30 | # Check for demo mode |
31 | 31 | |
32 | - if (Informer::isDemoMode()) return 'DEMO_MODE_RESTRICTION'; |
|
32 | + if (Informer::isDemoMode()) { |
|
33 | + return 'DEMO_MODE_RESTRICTION'; |
|
34 | + } |
|
33 | 35 | |
34 | 36 | # Validate name |
35 | 37 | |
36 | - if (false === ($name = Validate::fileName($name))) return ['name', 'FILEMANAGER_ERROR_NAME_INVALID']; |
|
38 | + if (false === ($name = Validate::fileName($name))) { |
|
39 | + return ['name', 'FILEMANAGER_ERROR_NAME_INVALID']; |
|
40 | + } |
|
37 | 41 | |
38 | 42 | # Check if item exists |
39 | 43 | |
40 | 44 | if ((0 !== strcasecmp($this->entity->name(), $name)) && |
41 | 45 | |
42 | - @file_exists($this->entity->parent()->pathFull() . $name)) return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
46 | + @file_exists($this->entity->parent()->pathFull() . $name)) { |
|
47 | + return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
48 | + } |
|
43 | 49 | |
44 | 50 | # Rename item |
45 | 51 | |
46 | - if (!$this->entity->rename($name)) return (($this->entity->type() === FILEMANAGER_TYPE_DIR) ? |
|
52 | + if (!$this->entity->rename($name)) { |
|
53 | + return (($this->entity->type() === FILEMANAGER_TYPE_DIR) ? |
|
47 | 54 | |
48 | 55 | 'FILEMANAGER_ERROR_DIR_RENAME' : 'FILEMANAGER_ERROR_FILE_RENAME'); |
56 | + } |
|
49 | 57 | |
50 | 58 | # ------------------------ |
51 | 59 |
@@ -37,7 +37,7 @@ |
||
37 | 37 | |
38 | 38 | # Check if item exists |
39 | 39 | |
40 | - if (@file_exists($this->parent->pathFull() . $name)) return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
40 | + if (@file_exists($this->parent->pathFull().$name)) return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
41 | 41 | |
42 | 42 | # Create item |
43 | 43 |
@@ -29,23 +29,31 @@ |
||
29 | 29 | |
30 | 30 | # Check for demo mode |
31 | 31 | |
32 | - if (Informer::isDemoMode()) return 'DEMO_MODE_RESTRICTION'; |
|
32 | + if (Informer::isDemoMode()) { |
|
33 | + return 'DEMO_MODE_RESTRICTION'; |
|
34 | + } |
|
33 | 35 | |
34 | 36 | # Validate name |
35 | 37 | |
36 | - if (false === ($name = Validate::fileName($name))) return ['name', 'FILEMANAGER_ERROR_NAME_INVALID']; |
|
38 | + if (false === ($name = Validate::fileName($name))) { |
|
39 | + return ['name', 'FILEMANAGER_ERROR_NAME_INVALID']; |
|
40 | + } |
|
37 | 41 | |
38 | 42 | # Check if item exists |
39 | 43 | |
40 | - if (@file_exists($this->parent->pathFull() . $name)) return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
44 | + if (@file_exists($this->parent->pathFull() . $name)) { |
|
45 | + return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
46 | + } |
|
41 | 47 | |
42 | 48 | # Create item |
43 | 49 | |
44 | 50 | $entity = Filemanager::get($type, $this->parent); |
45 | 51 | |
46 | - if (!$entity->create($name)) return (($entity->type() === FILEMANAGER_TYPE_DIR) ? |
|
52 | + if (!$entity->create($name)) { |
|
53 | + return (($entity->type() === FILEMANAGER_TYPE_DIR) ? |
|
47 | 54 | |
48 | 55 | 'FILEMANAGER_ERROR_DIR_CREATE' : 'FILEMANAGER_ERROR_FILE_CREATE'); |
56 | + } |
|
49 | 57 | |
50 | 58 | # ------------------------ |
51 | 59 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | $dirs = []; $files = []; |
17 | 17 | |
18 | - $prefix = (('' !== $this->parent->path()) ? ($this->parent->path() . '/') : ''); |
|
18 | + $prefix = (('' !== $this->parent->path()) ? ($this->parent->path().'/') : ''); |
|
19 | 19 | |
20 | 20 | # Read parent directory contents |
21 | 21 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | if (in_array($name, ['.', '..', '.empty'], true)) continue; |
27 | 27 | |
28 | - $path = ($prefix . $name); $path_full = ($this->parent->pathFull() . $name); |
|
28 | + $path = ($prefix.$name); $path_full = ($this->parent->pathFull().$name); |
|
29 | 29 | |
30 | 30 | $data = ['name' => $name, 'path' => $path, 'path_full' => $path_full]; |
31 | 31 | |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | |
113 | 113 | private function getPaginationBlock() { |
114 | 114 | |
115 | - $query = (('' !== $this->parent->path()) ? ('?parent=' . $this->parent->path()) : ''); |
|
115 | + $query = (('' !== $this->parent->path()) ? ('?parent='.$this->parent->path()) : ''); |
|
116 | 116 | |
117 | - $url = new Url(INSTALL_PATH . '/admin/content/filemanager' . $query); |
|
117 | + $url = new Url(INSTALL_PATH.'/admin/content/filemanager'.$query); |
|
118 | 118 | |
119 | 119 | # ------------------------ |
120 | 120 | |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | |
138 | 138 | # Set link |
139 | 139 | |
140 | - $query = (('' !== $this->parent->path()) ? ('?parent=' . $this->parent->path()) : ''); |
|
140 | + $query = (('' !== $this->parent->path()) ? ('?parent='.$this->parent->path()) : ''); |
|
141 | 141 | |
142 | - $contents->link = (INSTALL_PATH . '/admin/content/filemanager' . $query); |
|
142 | + $contents->link = (INSTALL_PATH.'/admin/content/filemanager'.$query); |
|
143 | 143 | |
144 | 144 | # Implement form |
145 | 145 | |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | |
181 | 181 | if ($upload || $this->form->handle(new Filemanager\Controller\Create($this->parent))) { |
182 | 182 | |
183 | - $query = (('' !== $this->parent->path()) ? ('?parent=' . $this->parent->path()) : ''); |
|
183 | + $query = (('' !== $this->parent->path()) ? ('?parent='.$this->parent->path()) : ''); |
|
184 | 184 | |
185 | - Request::redirect(INSTALL_PATH . '/admin/content/filemanager' . $query); |
|
185 | + Request::redirect(INSTALL_PATH.'/admin/content/filemanager'.$query); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | # Get index |
@@ -2,8 +2,15 @@ |
||
2 | 2 | |
3 | 3 | namespace Modules\Filemanager\Handler { |
4 | 4 | |
5 | - use Frames, Modules\Filemanager, Utils\Messages, Utils\Pagination, Utils\Uploader, Utils\View; |
|
6 | - use Ajax, Arr, Explorer, Language, Number, Request, Template, Url; |
|
5 | + use Frames; |
|
6 | + use Modules\Filemanager; |
|
7 | + use Utils\Pagination; |
|
8 | + use Utils\Uploader; |
|
9 | + use Utils\View; |
|
10 | + use Arr; |
|
11 | + use Number; |
|
12 | + use Request; |
|
13 | + use Url; |
|
7 | 14 | |
8 | 15 | class Lister extends Frames\Admin\Area\Authorized { |
9 | 16 |
@@ -25,15 +25,19 @@ discard block |
||
25 | 25 | |
26 | 26 | while (false !== ($name = readdir($handler))) { |
27 | 27 | |
28 | - if (in_array($name, ['.', '..', '.empty'], true)) continue; |
|
28 | + if (in_array($name, ['.', '..', '.empty'], true)) { |
|
29 | + continue; |
|
30 | + } |
|
29 | 31 | |
30 | 32 | $path = ($prefix . $name); $path_full = ($this->parent->pathFull() . $name); |
31 | 33 | |
32 | 34 | $data = ['name' => $name, 'path' => $path, 'path_full' => $path_full]; |
33 | 35 | |
34 | - if (@is_dir($path_full)) $dirs[] = array_merge($data, ['type' => FILEMANAGER_TYPE_DIR]); |
|
35 | - |
|
36 | - else if (@is_file($path_full)) $files[] = array_merge($data, ['type' => FILEMANAGER_TYPE_FILE]); |
|
36 | + if (@is_dir($path_full)) { |
|
37 | + $dirs[] = array_merge($data, ['type' => FILEMANAGER_TYPE_DIR]); |
|
38 | + } else if (@is_file($path_full)) { |
|
39 | + $files[] = array_merge($data, ['type' => FILEMANAGER_TYPE_FILE]); |
|
40 | + } |
|
37 | 41 | } |
38 | 42 | |
39 | 43 | closedir($handler); |
@@ -135,9 +139,11 @@ discard block |
||
135 | 139 | |
136 | 140 | foreach ($this->items['list'] as $item) { |
137 | 141 | |
138 | - if ($item['type'] === FILEMANAGER_TYPE_DIR) $items->addItem($this->getDirItemBlock($item)); |
|
139 | - |
|
140 | - else if ($item['type'] === FILEMANAGER_TYPE_FILE) $items->addItem($this->getFileItemBlock($item)); |
|
142 | + if ($item['type'] === FILEMANAGER_TYPE_DIR) { |
|
143 | + $items->addItem($this->getDirItemBlock($item)); |
|
144 | + } else if ($item['type'] === FILEMANAGER_TYPE_FILE) { |
|
145 | + $items->addItem($this->getFileItemBlock($item)); |
|
146 | + } |
|
141 | 147 | } |
142 | 148 | |
143 | 149 | # Set pagination |
@@ -19,11 +19,15 @@ |
||
19 | 19 | |
20 | 20 | private function add(string $type, string $name, array $args) { |
21 | 21 | |
22 | - if (('' === $name) || isset($this->list[$name])) return; |
|
22 | + if (('' === $name) || isset($this->list[$name])) { |
|
23 | + return; |
|
24 | + } |
|
23 | 25 | |
24 | 26 | $this->list[$name] = new $this->types[$type](...$args); |
25 | 27 | |
26 | - if (($type !== 'textual') || $this->list[$name]->short) $this->secure[] = $name; |
|
28 | + if (($type !== 'textual') || $this->list[$name]->short) { |
|
29 | + $this->secure[] = $name; |
|
30 | + } |
|
27 | 31 | } |
28 | 32 | |
29 | 33 | # Constructor |
@@ -32,11 +32,11 @@ |
||
32 | 32 | |
33 | 33 | public function statement() { |
34 | 34 | |
35 | - return ("FOREIGN KEY (`" . $this->name . "`) REFERENCES `" . $this->table . "` (`" . $this->field . "`)") . |
|
35 | + return ("FOREIGN KEY (`".$this->name."`) REFERENCES `".$this->table."` (`".$this->field."`)"). |
|
36 | 36 | |
37 | - ((null !== $this->delete) ? (" ON DELETE " . $this->delete) : "") . |
|
37 | + ((null !== $this->delete) ? (" ON DELETE ".$this->delete) : ""). |
|
38 | 38 | |
39 | - ((null !== $this->update) ? (" ON UPDATE " . $this->update) : ""); |
|
39 | + ((null !== $this->update) ? (" ON UPDATE ".$this->update) : ""); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | } |
@@ -23,9 +23,13 @@ |
||
23 | 23 | |
24 | 24 | $this->name = $name; $this->table = $table; $this->field = $field; |
25 | 25 | |
26 | - if (null !== $delete) $this->delete = $this->getAction($delete); |
|
26 | + if (null !== $delete) { |
|
27 | + $this->delete = $this->getAction($delete); |
|
28 | + } |
|
27 | 29 | |
28 | - if (null !== $update) $this->update = $this->getAction($delete); |
|
30 | + if (null !== $update) { |
|
31 | + $this->update = $this->getAction($delete); |
|
32 | + } |
|
29 | 33 | } |
30 | 34 | |
31 | 35 | # Get statement |
@@ -32,7 +32,7 @@ |
||
32 | 32 | |
33 | 33 | return ((null !== $this->type) ? ($this->type . " ") : "") . |
34 | 34 | |
35 | - ("KEY `" . $this->name . "` (`" . $this->name . "`)"); |
|
35 | + ("KEY `" . $this->name . "` (`" . $this->name . "`)"); |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | } |
@@ -30,9 +30,9 @@ |
||
30 | 30 | |
31 | 31 | public function statement() { |
32 | 32 | |
33 | - return ((null !== $this->type) ? ($this->type . " ") : "") . |
|
33 | + return ((null !== $this->type) ? ($this->type." ") : ""). |
|
34 | 34 | |
35 | - ("KEY `" . $this->name . "` (`" . $this->name . "`)"); |
|
35 | + ("KEY `".$this->name."` (`".$this->name."`)"); |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | } |
@@ -23,7 +23,9 @@ |
||
23 | 23 | |
24 | 24 | $this->name = $name; |
25 | 25 | |
26 | - if (null !== $type) $this->type = $this->getType($type); |
|
26 | + if (null !== $type) { |
|
27 | + $this->type = $this->getType($type); |
|
28 | + } |
|
27 | 29 | } |
28 | 30 | |
29 | 31 | # Get statement |
@@ -19,7 +19,7 @@ |
||
19 | 19 | |
20 | 20 | public function statement() { |
21 | 21 | |
22 | - return ("`" . $this->name . "` int(10) UNSIGNED NOT NULL" . ($this->auto_increment ? " AUTO_INCREMENT" : "")); |
|
22 | + return ("`".$this->name."` int(10) UNSIGNED NOT NULL".($this->auto_increment ? " AUTO_INCREMENT" : "")); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | # Cast value |
@@ -23,7 +23,7 @@ |
||
23 | 23 | |
24 | 24 | return ("`" . $this->name . "` " . ($this->short ? "tiny" : "") . "int(" . $this->length . ")") . |
25 | 25 | |
26 | - (($this->unsigned ? " UNSIGNED" : "") . " NOT NULL DEFAULT '" . $this->default . "'"); |
|
26 | + (($this->unsigned ? " UNSIGNED" : "") . " NOT NULL DEFAULT '" . $this->default . "'"); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | # Cast value |
@@ -21,9 +21,9 @@ |
||
21 | 21 | |
22 | 22 | public function statement() { |
23 | 23 | |
24 | - return ("`" . $this->name . "` " . ($this->short ? "tiny" : "") . "int(" . $this->length . ")") . |
|
24 | + return ("`".$this->name."` ".($this->short ? "tiny" : "")."int(".$this->length.")"). |
|
25 | 25 | |
26 | - (($this->unsigned ? " UNSIGNED" : "") . " NOT NULL DEFAULT '" . $this->default . "'"); |
|
26 | + (($this->unsigned ? " UNSIGNED" : "")." NOT NULL DEFAULT '".$this->default."'"); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | # Cast value |
@@ -16,7 +16,9 @@ |
||
16 | 16 | |
17 | 17 | # Set field configuration |
18 | 18 | |
19 | - foreach (get_defined_vars() as $name => $value) $this->$name = $value; |
|
19 | + foreach (get_defined_vars() as $name => $value) { |
|
20 | + $this->$name = $value; |
|
21 | + } |
|
20 | 22 | } |
21 | 23 | |
22 | 24 | # Get field statement |
@@ -23,7 +23,7 @@ |
||
23 | 23 | |
24 | 24 | return ("`" . $this->name . "` " . ($this->short ? ("varchar(" . $this->length . ")") : "text")) . |
25 | 25 | |
26 | - (($this->binary ? " BINARY" : "") . " NOT NULL DEFAULT '" . $this->default . "'"); |
|
26 | + (($this->binary ? " BINARY" : "") . " NOT NULL DEFAULT '" . $this->default . "'"); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | # Cast value |
@@ -21,9 +21,9 @@ |
||
21 | 21 | |
22 | 22 | public function statement() { |
23 | 23 | |
24 | - return ("`" . $this->name . "` " . ($this->short ? ("varchar(" . $this->length . ")") : "text")) . |
|
24 | + return ("`".$this->name."` ".($this->short ? ("varchar(".$this->length.")") : "text")). |
|
25 | 25 | |
26 | - (($this->binary ? " BINARY" : "") . " NOT NULL DEFAULT '" . $this->default . "'"); |
|
26 | + (($this->binary ? " BINARY" : "")." NOT NULL DEFAULT '".$this->default."'"); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | # Cast value |
@@ -16,7 +16,9 @@ |
||
16 | 16 | |
17 | 17 | # Set field configuration |
18 | 18 | |
19 | - foreach (get_defined_vars() as $name => $value) $this->$name = $value; |
|
19 | + foreach (get_defined_vars() as $name => $value) { |
|
20 | + $this->$name = $value; |
|
21 | + } |
|
20 | 22 | } |
21 | 23 | |
22 | 24 | # Get field statement |