@@ -12,9 +12,13 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | # Count pages |
| 14 | 14 | |
| 15 | - if (!(DB::select(TABLE_PAGES, 'COUNT(id) as count') && (DB::last()->rows === 1))) return false; |
|
| 15 | + if (!(DB::select(TABLE_PAGES, 'COUNT(id) as count') && (DB::last()->rows === 1))) { |
|
| 16 | + return false; |
|
| 17 | + } |
|
| 16 | 18 | |
| 17 | - if (intval(DB::last()->row()['count']) > 0) return true; |
|
| 19 | + if (intval(DB::last()->row()['count']) > 0) { |
|
| 20 | + return true; |
|
| 21 | + } |
|
| 18 | 22 | |
| 19 | 23 | # Insert initial pages |
| 20 | 24 | |
@@ -30,7 +34,8 @@ discard block |
||
| 30 | 34 | |
| 31 | 35 | 'time_created' => REQUEST_TIME, 'time_modified' => REQUEST_TIME]; |
| 32 | 36 | |
| 33 | - for ($i = 1; $i <= 3; $i++) $pages[] = ['visibility' => VISIBILITY_PUBLISHED, |
|
| 37 | + for ($i = 1; $i <= 3; $i++) { |
|
| 38 | + $pages[] = ['visibility' => VISIBILITY_PUBLISHED, |
|
| 34 | 39 | |
| 35 | 40 | 'hash' => Arr::encode([('page-' . $i), 0]), |
| 36 | 41 | |
@@ -39,6 +44,7 @@ discard block |
||
| 39 | 44 | 'contents' => Template::block(Language::get('INSTALL_PAGE_DEMO_CONTENTS'))->contents(), |
| 40 | 45 | |
| 41 | 46 | 'time_created' => REQUEST_TIME, 'time_modified' => REQUEST_TIME]; |
| 47 | + } |
|
| 42 | 48 | |
| 43 | 49 | # ------------------------ |
| 44 | 50 | |
@@ -51,19 +57,25 @@ discard block |
||
| 51 | 57 | |
| 52 | 58 | # Count menuitems |
| 53 | 59 | |
| 54 | - if (!(DB::select(TABLE_MENU, 'COUNT(id) as count') && (DB::last()->rows === 1))) return false; |
|
| 60 | + if (!(DB::select(TABLE_MENU, 'COUNT(id) as count') && (DB::last()->rows === 1))) { |
|
| 61 | + return false; |
|
| 62 | + } |
|
| 55 | 63 | |
| 56 | - if (intval(DB::last()->row()['count']) > 0) return true; |
|
| 64 | + if (intval(DB::last()->row()['count']) > 0) { |
|
| 65 | + return true; |
|
| 66 | + } |
|
| 57 | 67 | |
| 58 | 68 | # Insert initial menuitems |
| 59 | 69 | |
| 60 | 70 | $menu = []; |
| 61 | 71 | |
| 62 | - for ($i = 1; $i <= 3; $i++) $menu[] = [ |
|
| 72 | + for ($i = 1; $i <= 3; $i++) { |
|
| 73 | + $menu[] = [ |
|
| 63 | 74 | |
| 64 | 75 | 'position' => ($i - 1), 'slug' => ('page-' . $i), |
| 65 | 76 | |
| 66 | 77 | 'text' => (Language::get('INSTALL_PAGE_DEMO_TITLE') . ' ' . $i)]; |
| 78 | + } |
|
| 67 | 79 | |
| 68 | 80 | # ------------------------ |
| 69 | 81 | |
@@ -90,7 +102,9 @@ discard block |
||
| 90 | 102 | |
| 91 | 103 | $definitions[] = Entitizer\Definition::get(ENTITY_TYPE_USER_SESSION); |
| 92 | 104 | |
| 93 | - foreach ($definitions as $definition) if (!$definition->createTable()) return false; |
|
| 105 | + foreach ($definitions as $definition) { |
|
| 106 | + if (!$definition->createTable()) return false; |
|
| 107 | + } |
|
| 94 | 108 | |
| 95 | 109 | # ------------------------ |
| 96 | 110 | |
@@ -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 | # ------------------------ |