@@ -2,15 +2,15 @@ |
||
| 2 | 2 | |
| 3 | 3 | # Database tables |
| 4 | 4 | |
| 5 | -define('TABLE_PAGES', 'pages'); |
|
| 6 | -define('TABLE_PAGES_RELATIONS', 'pages_relations'); |
|
| 5 | +define('TABLE_PAGES', 'pages'); |
|
| 6 | +define('TABLE_PAGES_RELATIONS', 'pages_relations'); |
|
| 7 | 7 | |
| 8 | -define('TABLE_MENU', 'menu'); |
|
| 9 | -define('TABLE_MENU_RELATIONS', 'menu_relations'); |
|
| 8 | +define('TABLE_MENU', 'menu'); |
|
| 9 | +define('TABLE_MENU_RELATIONS', 'menu_relations'); |
|
| 10 | 10 | |
| 11 | -define('TABLE_VARIABLES', 'variables'); |
|
| 12 | -define('TABLE_WIDGETS', 'widgets'); |
|
| 11 | +define('TABLE_VARIABLES', 'variables'); |
|
| 12 | +define('TABLE_WIDGETS', 'widgets'); |
|
| 13 | 13 | |
| 14 | -define('TABLE_USERS', 'users'); |
|
| 15 | -define('TABLE_USERS_SECRETS', 'users_secrets'); |
|
| 16 | -define('TABLE_USERS_SESSIONS', 'users_sessions'); |
|
| 14 | +define('TABLE_USERS', 'users'); |
|
| 15 | +define('TABLE_USERS_SECRETS', 'users_secrets'); |
|
| 16 | +define('TABLE_USERS_SESSIONS', 'users_sessions'); |
|
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | public function __invoke(array $post) { |
| 12 | 12 | |
| 13 | - if (!Auth::check()) return false; |
|
| 13 | + if (!Auth::check()) { |
|
| 14 | + return false; |
|
| 15 | + } |
|
| 14 | 16 | |
| 15 | 17 | # Declare variables |
| 16 | 18 | |
@@ -22,13 +24,15 @@ discard block |
||
| 22 | 24 | |
| 23 | 25 | # Validate values |
| 24 | 26 | |
| 25 | - if (false === ($password_new = Validate::userPassword($password_new))) |
|
| 26 | - |
|
| 27 | + if (false === ($password_new = Validate::userPassword($password_new))) { |
|
| 28 | + |
|
| 27 | 29 | return ['password_new', 'USER_ERROR_PASSWORD_NEW_INVALID']; |
| 30 | + } |
|
| 28 | 31 | |
| 29 | - if (0 !== strcmp($password_new, $password_retype)) |
|
| 30 | - |
|
| 32 | + if (0 !== strcmp($password_new, $password_retype)) { |
|
| 33 | + |
|
| 31 | 34 | return ['password_retype', 'USER_ERROR_PASSWORD_MISMATCH']; |
| 35 | + } |
|
| 32 | 36 | |
| 33 | 37 | # Encode password |
| 34 | 38 | |
@@ -38,7 +42,9 @@ discard block |
||
| 38 | 42 | |
| 39 | 43 | $data = ['auth_key' => $auth_key, 'password' => $password]; |
| 40 | 44 | |
| 41 | - if (!Auth::user()->edit($data)) return 'USER_ERROR_AUTH_RECOVER'; |
|
| 45 | + if (!Auth::user()->edit($data)) { |
|
| 46 | + return 'USER_ERROR_AUTH_RECOVER'; |
|
| 47 | + } |
|
| 42 | 48 | |
| 43 | 49 | # Remove secret |
| 44 | 50 | |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | public function __invoke(array $post) { |
| 12 | 12 | |
| 13 | - if (Auth::check()) return true; |
|
| 13 | + if (Auth::check()) { |
|
| 14 | + return true; |
|
| 15 | + } |
|
| 14 | 16 | |
| 15 | 17 | # Declare variables |
| 16 | 18 | |
@@ -22,15 +24,25 @@ discard block |
||
| 22 | 24 | |
| 23 | 25 | # Validate values |
| 24 | 26 | |
| 25 | - if (false === ($name = Validate::userName($name))) return ['name', 'USER_ERROR_NAME_INVALID']; |
|
| 27 | + if (false === ($name = Validate::userName($name))) { |
|
| 28 | + return ['name', 'USER_ERROR_NAME_INVALID']; |
|
| 29 | + } |
|
| 26 | 30 | |
| 27 | - if (false === ($password = Validate::userPassword($password))) return ['password', 'USER_ERROR_PASSWORD_INVALID']; |
|
| 31 | + if (false === ($password = Validate::userPassword($password))) { |
|
| 32 | + return ['password', 'USER_ERROR_PASSWORD_INVALID']; |
|
| 33 | + } |
|
| 28 | 34 | |
| 29 | - if (false === ($email = Validate::userEmail($email))) return ['email', 'USER_ERROR_EMAIL_INVALID']; |
|
| 35 | + if (false === ($email = Validate::userEmail($email))) { |
|
| 36 | + return ['email', 'USER_ERROR_EMAIL_INVALID']; |
|
| 37 | + } |
|
| 30 | 38 | |
| 31 | - if (0 !== strcmp($password, $password_retype)) return ['password_retype', 'USER_ERROR_PASSWORD_MISMATCH']; |
|
| 39 | + if (0 !== strcmp($password, $password_retype)) { |
|
| 40 | + return ['password_retype', 'USER_ERROR_PASSWORD_MISMATCH']; |
|
| 41 | + } |
|
| 32 | 42 | |
| 33 | - if (false === Security::checkCaptcha($captcha)) return ['captcha', 'USER_ERROR_CAPTCHA_INCORRECT']; |
|
| 43 | + if (false === Security::checkCaptcha($captcha)) { |
|
| 44 | + return ['captcha', 'USER_ERROR_CAPTCHA_INCORRECT']; |
|
| 45 | + } |
|
| 34 | 46 | |
| 35 | 47 | # Create user object |
| 36 | 48 | |
@@ -38,15 +50,23 @@ discard block |
||
| 38 | 50 | |
| 39 | 51 | # Check name exists |
| 40 | 52 | |
| 41 | - if (false === ($check_name = $user->check($name, 'name'))) return 'USER_ERROR_AUTH_REGISTER'; |
|
| 53 | + if (false === ($check_name = $user->check($name, 'name'))) { |
|
| 54 | + return 'USER_ERROR_AUTH_REGISTER'; |
|
| 55 | + } |
|
| 42 | 56 | |
| 43 | - if ($check_name === 1) return ['name', 'USER_ERROR_NAME_DUPLICATE']; |
|
| 57 | + if ($check_name === 1) { |
|
| 58 | + return ['name', 'USER_ERROR_NAME_DUPLICATE']; |
|
| 59 | + } |
|
| 44 | 60 | |
| 45 | 61 | # Check email exists |
| 46 | 62 | |
| 47 | - if (false === ($check_email = $user->check($email, 'email'))) return 'USER_ERROR_AUTH_REGISTER'; |
|
| 63 | + if (false === ($check_email = $user->check($email, 'email'))) { |
|
| 64 | + return 'USER_ERROR_AUTH_REGISTER'; |
|
| 65 | + } |
|
| 48 | 66 | |
| 49 | - if ($check_email === 1) return ['email', 'USER_ERROR_EMAIL_DUPLICATE']; |
|
| 67 | + if ($check_email === 1) { |
|
| 68 | + return ['email', 'USER_ERROR_EMAIL_DUPLICATE']; |
|
| 69 | + } |
|
| 50 | 70 | |
| 51 | 71 | # Encode password |
| 52 | 72 | |
@@ -69,7 +89,9 @@ discard block |
||
| 69 | 89 | $data['time_registered'] = REQUEST_TIME; |
| 70 | 90 | $data['time_logged'] = REQUEST_TIME; |
| 71 | 91 | |
| 72 | - if (!$user->create($data)) return 'USER_ERROR_AUTH_REGISTER'; |
|
| 92 | + if (!$user->create($data)) { |
|
| 93 | + return 'USER_ERROR_AUTH_REGISTER'; |
|
| 94 | + } |
|
| 73 | 95 | |
| 74 | 96 | # Send mail |
| 75 | 97 | |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | public function __invoke(array $post) { |
| 12 | 12 | |
| 13 | - if (Auth::check()) return true; |
|
| 13 | + if (Auth::check()) { |
|
| 14 | + return true; |
|
| 15 | + } |
|
| 14 | 16 | |
| 15 | 17 | # Declare variables |
| 16 | 18 | |
@@ -22,9 +24,13 @@ discard block |
||
| 22 | 24 | |
| 23 | 25 | # Validate values |
| 24 | 26 | |
| 25 | - if (false === ($name = Validate::userName($name))) return ['name', 'USER_ERROR_NAME_INVALID']; |
|
| 27 | + if (false === ($name = Validate::userName($name))) { |
|
| 28 | + return ['name', 'USER_ERROR_NAME_INVALID']; |
|
| 29 | + } |
|
| 26 | 30 | |
| 27 | - if (false === Security::checkCaptcha($captcha)) return ['captcha', 'USER_ERROR_CAPTCHA_INCORRECT']; |
|
| 31 | + if (false === Security::checkCaptcha($captcha)) { |
|
| 32 | + return ['captcha', 'USER_ERROR_CAPTCHA_INCORRECT']; |
|
| 33 | + } |
|
| 28 | 34 | |
| 29 | 35 | # Create user object |
| 30 | 36 | |
@@ -32,13 +38,19 @@ discard block |
||
| 32 | 38 | |
| 33 | 39 | # Init user |
| 34 | 40 | |
| 35 | - if (!$user->init($name, 'name')) return ['name', 'USER_ERROR_NAME_INCORRECT']; |
|
| 41 | + if (!$user->init($name, 'name')) { |
|
| 42 | + return ['name', 'USER_ERROR_NAME_INCORRECT']; |
|
| 43 | + } |
|
| 36 | 44 | |
| 37 | - if (Auth::admin() && ($user->rank < RANK_ADMINISTRATOR)) return ['name', 'USER_ERROR_NAME_INCORRECT']; |
|
| 45 | + if (Auth::admin() && ($user->rank < RANK_ADMINISTRATOR)) { |
|
| 46 | + return ['name', 'USER_ERROR_NAME_INCORRECT']; |
|
| 47 | + } |
|
| 38 | 48 | |
| 39 | 49 | # Check access |
| 40 | 50 | |
| 41 | - if (!Auth::admin() && ($user->rank === RANK_GUEST)) return 'USER_ERROR_ACCESS'; |
|
| 51 | + if (!Auth::admin() && ($user->rank === RANK_GUEST)) { |
|
| 52 | + return 'USER_ERROR_ACCESS'; |
|
| 53 | + } |
|
| 42 | 54 | |
| 43 | 55 | # Create session |
| 44 | 56 | |
@@ -48,7 +60,9 @@ discard block |
||
| 48 | 60 | |
| 49 | 61 | $data = ['id' => $user->id, 'code' => $code, 'ip' => $ip, 'time' => $time]; |
| 50 | 62 | |
| 51 | - if (!$secret->create($data)) return 'USER_ERROR_AUTH_RESET'; |
|
| 63 | + if (!$secret->create($data)) { |
|
| 64 | + return 'USER_ERROR_AUTH_RESET'; |
|
| 65 | + } |
|
| 52 | 66 | |
| 53 | 67 | # Send mail |
| 54 | 68 | |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | public function __invoke(array $post) { |
| 12 | 12 | |
| 13 | - if (Auth::check()) return true; |
|
| 13 | + if (Auth::check()) { |
|
| 14 | + return true; |
|
| 15 | + } |
|
| 14 | 16 | |
| 15 | 17 | # Declare variables |
| 16 | 18 | |
@@ -22,9 +24,13 @@ discard block |
||
| 22 | 24 | |
| 23 | 25 | # Validate values |
| 24 | 26 | |
| 25 | - if (false === ($name = Validate::userName($name))) return ['name', 'USER_ERROR_NAME_INVALID']; |
|
| 27 | + if (false === ($name = Validate::userName($name))) { |
|
| 28 | + return ['name', 'USER_ERROR_NAME_INVALID']; |
|
| 29 | + } |
|
| 26 | 30 | |
| 27 | - if (false === ($password = Validate::userPassword($password))) return ['password', 'USER_ERROR_PASSWORD_INVALID']; |
|
| 31 | + if (false === ($password = Validate::userPassword($password))) { |
|
| 32 | + return ['password', 'USER_ERROR_PASSWORD_INVALID']; |
|
| 33 | + } |
|
| 28 | 34 | |
| 29 | 35 | # Create user object |
| 30 | 36 | |
@@ -32,19 +38,27 @@ discard block |
||
| 32 | 38 | |
| 33 | 39 | # Init user |
| 34 | 40 | |
| 35 | - if (!$user->init($name, 'name')) return ['name', 'USER_ERROR_NAME_INCORRECT']; |
|
| 41 | + if (!$user->init($name, 'name')) { |
|
| 42 | + return ['name', 'USER_ERROR_NAME_INCORRECT']; |
|
| 43 | + } |
|
| 36 | 44 | |
| 37 | - if (Auth::admin() && ($user->rank < RANK_ADMINISTRATOR)) return ['name', 'USER_ERROR_NAME_INCORRECT']; |
|
| 45 | + if (Auth::admin() && ($user->rank < RANK_ADMINISTRATOR)) { |
|
| 46 | + return ['name', 'USER_ERROR_NAME_INCORRECT']; |
|
| 47 | + } |
|
| 38 | 48 | |
| 39 | 49 | # Check password |
| 40 | 50 | |
| 41 | 51 | $password = Str::encode($user->auth_key, $password); |
| 42 | 52 | |
| 43 | - if (0 !== strcmp($user->password, $password)) return ['password', 'USER_ERROR_PASSWORD_INCORRECT']; |
|
| 53 | + if (0 !== strcmp($user->password, $password)) { |
|
| 54 | + return ['password', 'USER_ERROR_PASSWORD_INCORRECT']; |
|
| 55 | + } |
|
| 44 | 56 | |
| 45 | 57 | # Check access |
| 46 | 58 | |
| 47 | - if (!Auth::admin() && ($user->rank === RANK_GUEST)) return 'USER_ERROR_ACCESS'; |
|
| 59 | + if (!Auth::admin() && ($user->rank === RANK_GUEST)) { |
|
| 60 | + return 'USER_ERROR_ACCESS'; |
|
| 61 | + } |
|
| 48 | 62 | |
| 49 | 63 | # Create session |
| 50 | 64 | |
@@ -54,7 +68,9 @@ discard block |
||
| 54 | 68 | |
| 55 | 69 | $data = ['id' => $user->id, 'code' => $code, 'ip' => $ip, 'time' => $time]; |
| 56 | 70 | |
| 57 | - if (!$session->create($data)) return 'USER_ERROR_AUTH_LOGIN'; |
|
| 71 | + if (!$session->create($data)) { |
|
| 72 | + return 'USER_ERROR_AUTH_LOGIN'; |
|
| 73 | + } |
|
| 58 | 74 | |
| 59 | 75 | # Set session variable |
| 60 | 76 | |
@@ -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,19 +29,25 @@ |
||
| 29 | 29 | |
| 30 | 30 | # Validate name |
| 31 | 31 | |
| 32 | - if (false === ($name = Validate::fileName($name))) return ['name', 'FILEMANAGER_ERROR_NAME_INVALID']; |
|
| 32 | + if (false === ($name = Validate::fileName($name))) { |
|
| 33 | + return ['name', 'FILEMANAGER_ERROR_NAME_INVALID']; |
|
| 34 | + } |
|
| 33 | 35 | |
| 34 | 36 | # Check if item exists |
| 35 | 37 | |
| 36 | 38 | if ((0 !== strcasecmp($this->entity->name(), $name)) && |
| 37 | 39 | |
| 38 | - @file_exists($this->entity->parent()->pathFull() . $name)) return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
| 40 | + @file_exists($this->entity->parent()->pathFull() . $name)) { |
|
| 41 | + return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
| 42 | + } |
|
| 39 | 43 | |
| 40 | 44 | # Rename item |
| 41 | 45 | |
| 42 | - if (!$this->entity->rename($name)) return (($this->entity->type() === FILEMANAGER_TYPE_DIR) ? |
|
| 46 | + if (!$this->entity->rename($name)) { |
|
| 47 | + return (($this->entity->type() === FILEMANAGER_TYPE_DIR) ? |
|
| 43 | 48 | |
| 44 | 49 | 'FILEMANAGER_ERROR_DIR_RENAME' : 'FILEMANAGER_ERROR_FILE_RENAME'); |
| 50 | + } |
|
| 45 | 51 | |
| 46 | 52 | # ------------------------ |
| 47 | 53 | |
@@ -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,19 +29,25 @@ |
||
| 29 | 29 | |
| 30 | 30 | # Validate name |
| 31 | 31 | |
| 32 | - if (false === ($name = Validate::fileName($name))) return ['name', 'FILEMANAGER_ERROR_NAME_INVALID']; |
|
| 32 | + if (false === ($name = Validate::fileName($name))) { |
|
| 33 | + return ['name', 'FILEMANAGER_ERROR_NAME_INVALID']; |
|
| 34 | + } |
|
| 33 | 35 | |
| 34 | 36 | # Check if item exists |
| 35 | 37 | |
| 36 | - if (@file_exists($this->parent->pathFull() . $name)) return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
| 38 | + if (@file_exists($this->parent->pathFull() . $name)) { |
|
| 39 | + return ['name', 'FILEMANAGER_ERROR_EXISTS']; |
|
| 40 | + } |
|
| 37 | 41 | |
| 38 | 42 | # Create item |
| 39 | 43 | |
| 40 | 44 | $entity = Filemanager::get($type, $this->parent); |
| 41 | 45 | |
| 42 | - if (!$entity->create($name)) return (($entity->type() === FILEMANAGER_TYPE_DIR) ? |
|
| 46 | + if (!$entity->create($name)) { |
|
| 47 | + return (($entity->type() === FILEMANAGER_TYPE_DIR) ? |
|
| 43 | 48 | |
| 44 | 49 | 'FILEMANAGER_ERROR_DIR_CREATE' : 'FILEMANAGER_ERROR_FILE_CREATE'); |
| 50 | + } |
|
| 45 | 51 | |
| 46 | 52 | # ------------------------ |
| 47 | 53 | |
@@ -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 |
@@ -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[] = ($data + ['type' => FILEMANAGER_TYPE_DIR]); |
|
| 35 | - |
|
| 36 | - else if (@is_file($path_full)) $files[] = ($data + ['type' => FILEMANAGER_TYPE_FILE]); |
|
| 36 | + if (@is_dir($path_full)) { |
|
| 37 | + $dirs[] = ($data + ['type' => FILEMANAGER_TYPE_DIR]); |
|
| 38 | + } else if (@is_file($path_full)) { |
|
| 39 | + $files[] = ($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 |