@@ -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 | |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | |
| 46 | 46 | if ($this->form_personal->handle($controller_personal) || $this->form_password->handle($controller_password)) { |
| 47 | 47 | |
| 48 | - Request::redirect(INSTALL_PATH . '/profile/edit?submitted'); |
|
| 48 | + Request::redirect(INSTALL_PATH.'/profile/edit?submitted'); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | # Display success message |
@@ -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 | |
@@ -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 | |
@@ -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 |
@@ -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 | |
@@ -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 | |
@@ -14,9 +14,9 @@ |
||
| 14 | 14 | |
| 15 | 15 | if (preg_match('/[\/\\\\]/', $name)) return false; |
| 16 | 16 | |
| 17 | - $path = (($this->parent->path() ? ($this->parent->path() . '/') : '') . $name); |
|
| 17 | + $path = (($this->parent->path() ? ($this->parent->path().'/') : '').$name); |
|
| 18 | 18 | |
| 19 | - $path_full = ($this->parent->pathFull() . $name); |
|
| 19 | + $path_full = ($this->parent->pathFull().$name); |
|
| 20 | 20 | |
| 21 | 21 | # ------------------------ |
| 22 | 22 | |
@@ -12,19 +12,33 @@ |
||
| 12 | 12 | |
| 13 | 13 | $extension = strtolower(Explorer::extension($file_name, false)); |
| 14 | 14 | |
| 15 | - if (self::isImage($extension)) return 'image'; |
|
| 15 | + if (self::isImage($extension)) { |
|
| 16 | + return 'image'; |
|
| 17 | + } |
|
| 16 | 18 | |
| 17 | - if (self::isAudio($extension)) return 'audio'; |
|
| 19 | + if (self::isAudio($extension)) { |
|
| 20 | + return 'audio'; |
|
| 21 | + } |
|
| 18 | 22 | |
| 19 | - if (self::isVideo($extension)) return 'video'; |
|
| 23 | + if (self::isVideo($extension)) { |
|
| 24 | + return 'video'; |
|
| 25 | + } |
|
| 20 | 26 | |
| 21 | - if (in_array($extension, ['doc', 'docx'], true)) return 'word'; |
|
| 27 | + if (in_array($extension, ['doc', 'docx'], true)) { |
|
| 28 | + return 'word'; |
|
| 29 | + } |
|
| 22 | 30 | |
| 23 | - if (in_array($extension, ['xls', 'xlsx'], true)) return 'excel'; |
|
| 31 | + if (in_array($extension, ['xls', 'xlsx'], true)) { |
|
| 32 | + return 'excel'; |
|
| 33 | + } |
|
| 24 | 34 | |
| 25 | - if (in_array($extension, ['ppt', 'pptx'], true)) return 'powerpoint'; |
|
| 35 | + if (in_array($extension, ['ppt', 'pptx'], true)) { |
|
| 36 | + return 'powerpoint'; |
|
| 37 | + } |
|
| 26 | 38 | |
| 27 | - if ($extension === 'pdf') return 'pdf'; |
|
| 39 | + if ($extension === 'pdf') { |
|
| 40 | + return 'pdf'; |
|
| 41 | + } |
|
| 28 | 42 | |
| 29 | 43 | # ------------------------ |
| 30 | 44 | |
@@ -35,11 +35,15 @@ |
||
| 35 | 35 | |
| 36 | 36 | # Check if install file exists |
| 37 | 37 | |
| 38 | - if (Informer::checkInstallFile()) Messages::error(Language::get('DASHBOARD_MESSAGE_INSTALL_FILE')); |
|
| 38 | + if (Informer::checkInstallFile()) { |
|
| 39 | + Messages::error(Language::get('DASHBOARD_MESSAGE_INSTALL_FILE')); |
|
| 40 | + } |
|
| 39 | 41 | |
| 40 | 42 | # Check if configuration file is loaded |
| 41 | 43 | |
| 42 | - if (!Settings::loaded()) Messages::warning(Language::get('DASHBOARD_MESSAGE_CONFIG_FILE')); |
|
| 44 | + if (!Settings::loaded()) { |
|
| 45 | + Messages::warning(Language::get('DASHBOARD_MESSAGE_CONFIG_FILE')); |
|
| 46 | + } |
|
| 43 | 47 | |
| 44 | 48 | # ------------------------ |
| 45 | 49 | |