@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | |
42 | 42 | protected function processEntityParent(Template\Block $parent) { |
43 | 43 | |
44 | - if ((0 !== $this->parent->id) && $this->parent->active) $parent->getBlock('browse')->link = $this->parent->link; |
|
45 | - |
|
46 | - else { $parent->getBlock('browse')->disable(); $parent->getBlock('browse_disabled')->enable(); } |
|
44 | + if ((0 !== $this->parent->id) && $this->parent->active) { |
|
45 | + $parent->getBlock('browse')->link = $this->parent->link; |
|
46 | + } else { $parent->getBlock('browse')->disable(); $parent->getBlock('browse_disabled')->enable(); } |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -52,7 +52,9 @@ discard block |
||
52 | 52 | |
53 | 53 | protected function processEntity(Template\Block $contents) { |
54 | 54 | |
55 | - if (!$this->create && $this->parent->locked) $contents->getBlock('locked')->enable(); |
|
55 | + if (!$this->create && $this->parent->locked) { |
|
56 | + $contents->getBlock('locked')->enable(); |
|
57 | + } |
|
56 | 58 | } |
57 | 59 | } |
58 | 60 | } |
@@ -37,9 +37,9 @@ |
||
37 | 37 | |
38 | 38 | protected function processEntityParent(Template\Block $parent) { |
39 | 39 | |
40 | - if (0 !== $this->parent->id) $parent->getBlock('browse')->link = $this->parent->link; |
|
41 | - |
|
42 | - else { $parent->getBlock('browse')->disable(); $parent->getBlock('browse_disabled')->enable(); } |
|
40 | + if (0 !== $this->parent->id) { |
|
41 | + $parent->getBlock('browse')->link = $this->parent->link; |
|
42 | + } else { $parent->getBlock('browse')->disable(); $parent->getBlock('browse_disabled')->enable(); } |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -23,19 +23,19 @@ |
||
23 | 23 | |
24 | 24 | # Add params |
25 | 25 | |
26 | - $this->params->addTextual ('code', true, 40, true, ''); |
|
27 | - $this->params->addTextual ('ip', true, 255, false, ''); |
|
28 | - $this->params->addInteger ('time', false, 10, true, 0); |
|
26 | + $this->params->addTextual('code', true, 40, true, ''); |
|
27 | + $this->params->addTextual('ip', true, 255, false, ''); |
|
28 | + $this->params->addInteger('time', false, 10, true, 0); |
|
29 | 29 | |
30 | 30 | # Add indexes |
31 | 31 | |
32 | - $this->indexes->add ('code', 'UNIQUE'); |
|
33 | - $this->indexes->add ('ip'); |
|
34 | - $this->indexes->add ('time'); |
|
32 | + $this->indexes->add('code', 'UNIQUE'); |
|
33 | + $this->indexes->add('ip'); |
|
34 | + $this->indexes->add('time'); |
|
35 | 35 | |
36 | 36 | # Add foreign keys |
37 | 37 | |
38 | - $this->foreigns->add ('id', TABLE_USERS, 'id', 'CASCADE', 'RESTRICT'); |
|
38 | + $this->foreigns->add('id', TABLE_USERS, 'id', 'CASCADE', 'RESTRICT'); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | /** |
184 | 184 | * Get the entity creation time |
185 | 185 | * |
186 | - * @return int|false : the time or false on failure |
|
186 | + * @return null|integer : the time or false on failure |
|
187 | 187 | */ |
188 | 188 | |
189 | 189 | public function getCreated() { |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | /** |
210 | 210 | * Get the entity modification time |
211 | 211 | * |
212 | - * @return int|false : the time or false on failure |
|
212 | + * @return null|integer : the time or false on failure |
|
213 | 213 | */ |
214 | 214 | |
215 | 215 | public function getModified() { |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | /** |
236 | 236 | * Get the entity size |
237 | 237 | * |
238 | - * @return int|false : the size or false on failure |
|
238 | + * @return integer : the size or false on failure |
|
239 | 239 | */ |
240 | 240 | |
241 | 241 | public function getSize() { |
@@ -27,9 +27,9 @@ |
||
27 | 27 | |
28 | 28 | if ($this->parent->isIgnoreHidden() && preg_match('/^\./', $name)) return false; |
29 | 29 | |
30 | - $path = (($this->parent->getPath() ? ($this->parent->getPath() . '/') : '') . $name); |
|
30 | + $path = (($this->parent->getPath() ? ($this->parent->getPath().'/') : '').$name); |
|
31 | 31 | |
32 | - $path_full = ($this->parent->getPathFull() . $name); |
|
32 | + $path_full = ($this->parent->getPathFull().$name); |
|
33 | 33 | |
34 | 34 | # ------------------------ |
35 | 35 |
@@ -23,9 +23,13 @@ discard block |
||
23 | 23 | |
24 | 24 | private function getPrototype(string $name) { |
25 | 25 | |
26 | - if (('' === $name) || preg_match('/[\/\\\\]/', $name)) return false; |
|
26 | + if (('' === $name) || preg_match('/[\/\\\\]/', $name)) { |
|
27 | + return false; |
|
28 | + } |
|
27 | 29 | |
28 | - if ($this->parent->isIgnoreHidden() && preg_match('/^\./', $name)) return false; |
|
30 | + if ($this->parent->isIgnoreHidden() && preg_match('/^\./', $name)) { |
|
31 | + return false; |
|
32 | + } |
|
29 | 33 | |
30 | 34 | $path = (($this->parent->getPath() ? ($this->parent->getPath() . '/') : '') . $name); |
31 | 35 | |
@@ -53,17 +57,23 @@ discard block |
||
53 | 57 | |
54 | 58 | public function init(string $name) : bool { |
55 | 59 | |
56 | - if (false === ($prototype = $this->getPrototype($name))) return false; |
|
60 | + if (false === ($prototype = $this->getPrototype($name))) { |
|
61 | + return false; |
|
62 | + } |
|
57 | 63 | |
58 | 64 | # Check type |
59 | 65 | |
60 | 66 | $type = Explorer::getType($prototype['path_full']); |
61 | 67 | |
62 | - if (!in_array($type, ['dir', 'file'], true)) return false; |
|
68 | + if (!in_array($type, ['dir', 'file'], true)) { |
|
69 | + return false; |
|
70 | + } |
|
63 | 71 | |
64 | 72 | # Set data |
65 | 73 | |
66 | - foreach ($prototype as $var => $value) $this->$var = $value; |
|
74 | + foreach ($prototype as $var => $value) { |
|
75 | + $this->$var = $value; |
|
76 | + } |
|
67 | 77 | |
68 | 78 | $this->type = $type; |
69 | 79 | |
@@ -81,9 +91,13 @@ discard block |
||
81 | 91 | |
82 | 92 | public function check(string $name) : bool { |
83 | 93 | |
84 | - if (false === ($prototype = $this->getPrototype($name))) return false; |
|
94 | + if (false === ($prototype = $this->getPrototype($name))) { |
|
95 | + return false; |
|
96 | + } |
|
85 | 97 | |
86 | - if (($name !== $this->name) && Explorer::exists($prototype['path_full'])) return false; |
|
98 | + if (($name !== $this->name) && Explorer::exists($prototype['path_full'])) { |
|
99 | + return false; |
|
100 | + } |
|
87 | 101 | |
88 | 102 | # ------------------------ |
89 | 103 | |
@@ -98,19 +112,27 @@ discard block |
||
98 | 112 | |
99 | 113 | public function create(string $name, string $type) : bool { |
100 | 114 | |
101 | - if (('' !== $this->name) || (false === ($prototype = $this->getPrototype($name)))) return false; |
|
115 | + if (('' !== $this->name) || (false === ($prototype = $this->getPrototype($name)))) { |
|
116 | + return false; |
|
117 | + } |
|
102 | 118 | |
103 | - if (!in_array($type, ['dir', 'file'], true)) return false; |
|
119 | + if (!in_array($type, ['dir', 'file'], true)) { |
|
120 | + return false; |
|
121 | + } |
|
104 | 122 | |
105 | 123 | # Create entity |
106 | 124 | |
107 | 125 | $create = (($type === 'dir') ? 'createDir' : 'createFile'); |
108 | 126 | |
109 | - if (!Explorer::$create($prototype['path_full'])) return false; |
|
127 | + if (!Explorer::$create($prototype['path_full'])) { |
|
128 | + return false; |
|
129 | + } |
|
110 | 130 | |
111 | 131 | # Set data |
112 | 132 | |
113 | - foreach ($prototype as $var => $value) $this->$var = $value; |
|
133 | + foreach ($prototype as $var => $value) { |
|
134 | + $this->$var = $value; |
|
135 | + } |
|
114 | 136 | |
115 | 137 | $this->type = $type; |
116 | 138 | |
@@ -127,15 +149,21 @@ discard block |
||
127 | 149 | |
128 | 150 | public function rename(string $name) : bool { |
129 | 151 | |
130 | - if (('' === $this->name) || (false === ($prototype = $this->getPrototype($name)))) return false; |
|
152 | + if (('' === $this->name) || (false === ($prototype = $this->getPrototype($name)))) { |
|
153 | + return false; |
|
154 | + } |
|
131 | 155 | |
132 | 156 | # Rename entity |
133 | 157 | |
134 | - if (!Explorer::rename($this->path_full, $prototype['path_full'])) return false; |
|
158 | + if (!Explorer::rename($this->path_full, $prototype['path_full'])) { |
|
159 | + return false; |
|
160 | + } |
|
135 | 161 | |
136 | 162 | # Set data |
137 | 163 | |
138 | - foreach ($prototype as $var => $value) $this->$var = $value; |
|
164 | + foreach ($prototype as $var => $value) { |
|
165 | + $this->$var = $value; |
|
166 | + } |
|
139 | 167 | |
140 | 168 | # ------------------------ |
141 | 169 | |
@@ -150,13 +178,17 @@ discard block |
||
150 | 178 | |
151 | 179 | public function remove() : bool { |
152 | 180 | |
153 | - if ('' === $this->name) return false; |
|
181 | + if ('' === $this->name) { |
|
182 | + return false; |
|
183 | + } |
|
154 | 184 | |
155 | 185 | # Remove entity |
156 | 186 | |
157 | 187 | $remove = (($this->type === 'dir') ? 'removeDir' : 'removeFile'); |
158 | 188 | |
159 | - if (!Explorer::$remove($this->path_full, true)) return false; |
|
189 | + if (!Explorer::$remove($this->path_full, true)) { |
|
190 | + return false; |
|
191 | + } |
|
160 | 192 | |
161 | 193 | # Reset data |
162 | 194 | |
@@ -175,7 +207,9 @@ discard block |
||
175 | 207 | |
176 | 208 | public function getExtension() { |
177 | 209 | |
178 | - if ('' === $this->name) return false; |
|
210 | + if ('' === $this->name) { |
|
211 | + return false; |
|
212 | + } |
|
179 | 213 | |
180 | 214 | return strtolower(Explorer::getExtension($this->name, false)); |
181 | 215 | } |
@@ -188,7 +222,9 @@ discard block |
||
188 | 222 | |
189 | 223 | public function getCreated() { |
190 | 224 | |
191 | - if ('' === $this->name) return false; |
|
225 | + if ('' === $this->name) { |
|
226 | + return false; |
|
227 | + } |
|
192 | 228 | |
193 | 229 | return Explorer::getCreated($this->path_full); |
194 | 230 | } |
@@ -201,7 +237,9 @@ discard block |
||
201 | 237 | |
202 | 238 | public function getAccessed() { |
203 | 239 | |
204 | - if ('' === $this->name) return false; |
|
240 | + if ('' === $this->name) { |
|
241 | + return false; |
|
242 | + } |
|
205 | 243 | |
206 | 244 | return Explorer::getAccessed($this->path_full); |
207 | 245 | } |
@@ -214,7 +252,9 @@ discard block |
||
214 | 252 | |
215 | 253 | public function getModified() { |
216 | 254 | |
217 | - if ('' === $this->name) return false; |
|
255 | + if ('' === $this->name) { |
|
256 | + return false; |
|
257 | + } |
|
218 | 258 | |
219 | 259 | return Explorer::getModified($this->path_full); |
220 | 260 | } |
@@ -227,7 +267,9 @@ discard block |
||
227 | 267 | |
228 | 268 | public function getPermissions() { |
229 | 269 | |
230 | - if ('' === $this->name) return false; |
|
270 | + if ('' === $this->name) { |
|
271 | + return false; |
|
272 | + } |
|
231 | 273 | |
232 | 274 | return Explorer::getPermissions($this->path_full); |
233 | 275 | } |
@@ -240,7 +282,9 @@ discard block |
||
240 | 282 | |
241 | 283 | public function getSize() { |
242 | 284 | |
243 | - if ('' === $this->name) return false; |
|
285 | + if ('' === $this->name) { |
|
286 | + return false; |
|
287 | + } |
|
244 | 288 | |
245 | 289 | return Explorer::getSize($this->path_full); |
246 | 290 | } |
@@ -253,7 +297,9 @@ discard block |
||
253 | 297 | |
254 | 298 | public function getContents() { |
255 | 299 | |
256 | - if ('' === $this->name) return false; |
|
300 | + if ('' === $this->name) { |
|
301 | + return false; |
|
302 | + } |
|
257 | 303 | |
258 | 304 | return Explorer::getContents($this->path_full); |
259 | 305 | } |
@@ -266,7 +312,9 @@ discard block |
||
266 | 312 | |
267 | 313 | public function putContents(string $contents) { |
268 | 314 | |
269 | - if ('' === $this->name) return false; |
|
315 | + if ('' === $this->name) { |
|
316 | + return false; |
|
317 | + } |
|
270 | 318 | |
271 | 319 | return Explorer::putContents($this->path_full, $contents); |
272 | 320 | } |
@@ -21,7 +21,9 @@ |
||
21 | 21 | |
22 | 22 | protected function handle(bool $ajax = false) { |
23 | 23 | |
24 | - if (!$ajax) return false; |
|
24 | + if (!$ajax) { |
|
25 | + return false; |
|
26 | + } |
|
25 | 27 | |
26 | 28 | # Create response |
27 | 29 |
@@ -33,9 +33,9 @@ |
||
33 | 33 | |
34 | 34 | # Save uploaded file |
35 | 35 | |
36 | - if (true === ($upload = (Uploader::save('upload', (DIR_UPLOADS . $target_dir))))) { |
|
36 | + if (true === ($upload = (Uploader::save('upload', (DIR_UPLOADS.$target_dir))))) { |
|
37 | 37 | |
38 | - $name = Uploader::getBasename(); $url = (INSTALL_PATH . '/uploads/' . $target_dir . $name); |
|
38 | + $name = Uploader::getBasename(); $url = (INSTALL_PATH.'/uploads/'.$target_dir.$name); |
|
39 | 39 | |
40 | 40 | $ajax->set('name', $name)->set('url', $url); |
41 | 41 |
@@ -44,19 +44,27 @@ |
||
44 | 44 | |
45 | 45 | # Validate name |
46 | 46 | |
47 | - if (false === ($name = Validate::fileName($name))) return ['name', 'FILEMANAGER_ERROR_NAME_INVALID']; |
|
47 | + if (false === ($name = Validate::fileName($name))) { |
|
48 | + return ['name', 'FILEMANAGER_ERROR_NAME_INVALID']; |
|
49 | + } |
|
48 | 50 | |
49 | - if ($this->parent->isIgnoreHidden() && preg_match('/^\./', $name)) return ['name', 'FILEMANAGER_ERROR_HIDDEN']; |
|
51 | + if ($this->parent->isIgnoreHidden() && preg_match('/^\./', $name)) { |
|
52 | + return ['name', 'FILEMANAGER_ERROR_HIDDEN']; |
|
53 | + } |
|
50 | 54 | |
51 | 55 | # Check if name is used |
52 | 56 | |
53 | - if (!$this->entity->check($name)) return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
57 | + if (!$this->entity->check($name)) { |
|
58 | + return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
59 | + } |
|
54 | 60 | |
55 | 61 | # Rename entity |
56 | 62 | |
57 | - if (!$this->entity->rename($name)) return (($this->entity->getType() === 'dir') ? |
|
63 | + if (!$this->entity->rename($name)) { |
|
64 | + return (($this->entity->getType() === 'dir') ? |
|
58 | 65 | |
59 | 66 | 'FILEMANAGER_ERROR_DIR_RENAME' : 'FILEMANAGER_ERROR_FILE_RENAME'); |
67 | + } |
|
60 | 68 | |
61 | 69 | # ------------------------ |
62 | 70 |
@@ -44,7 +44,9 @@ |
||
44 | 44 | |
45 | 45 | # Rename item |
46 | 46 | |
47 | - if (false === $this->entity->putContents($contents)) return 'FILEMANAGER_ERROR_FILE_EDIT'; |
|
47 | + if (false === $this->entity->putContents($contents)) { |
|
48 | + return 'FILEMANAGER_ERROR_FILE_EDIT'; |
|
49 | + } |
|
48 | 50 | |
49 | 51 | # ------------------------ |
50 | 52 |
@@ -44,9 +44,13 @@ discard block |
||
44 | 44 | |
45 | 45 | # Validate name |
46 | 46 | |
47 | - if (false === ($name = Validate::fileName($name))) return ['name', 'FILEMANAGER_ERROR_NAME_INVALID']; |
|
47 | + if (false === ($name = Validate::fileName($name))) { |
|
48 | + return ['name', 'FILEMANAGER_ERROR_NAME_INVALID']; |
|
49 | + } |
|
48 | 50 | |
49 | - if ($this->parent->isIgnoreHidden() && preg_match('/^\./', $name)) return ['name', 'FILEMANAGER_ERROR_HIDDEN']; |
|
51 | + if ($this->parent->isIgnoreHidden() && preg_match('/^\./', $name)) { |
|
52 | + return ['name', 'FILEMANAGER_ERROR_HIDDEN']; |
|
53 | + } |
|
50 | 54 | |
51 | 55 | # Get entity |
52 | 56 | |
@@ -54,11 +58,15 @@ discard block |
||
54 | 58 | |
55 | 59 | # Check if name is used |
56 | 60 | |
57 | - if (!$entity->check($name)) return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
61 | + if (!$entity->check($name)) { |
|
62 | + return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
63 | + } |
|
58 | 64 | |
59 | 65 | # Create entity |
60 | 66 | |
61 | - if (!$entity->create($name, 'dir')) return 'FILEMANAGER_ERROR_DIR_CREATE'; |
|
67 | + if (!$entity->create($name, 'dir')) { |
|
68 | + return 'FILEMANAGER_ERROR_DIR_CREATE'; |
|
69 | + } |
|
62 | 70 | |
63 | 71 | # ------------------------ |
64 | 72 |
@@ -15,6 +15,6 @@ |
||
15 | 15 | |
16 | 16 | use Filemanager\Common\Addons; |
17 | 17 | |
18 | - protected $path_full = (DIR_SYSTEM_CLASSES . 'Addons/'); |
|
18 | + protected $path_full = (DIR_SYSTEM_CLASSES.'Addons/'); |
|
19 | 19 | } |
20 | 20 | } |