@@ -47,13 +47,17 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | # Check for demo mode |
| 49 | 49 | |
| 50 | - if (Informer::isDemoMode()) return $ajax->error(Language::get('DEMO_MODE_RESTRICTION')); |
|
| 50 | + if (Informer::isDemoMode()) { |
|
| 51 | + return $ajax->error(Language::get('DEMO_MODE_RESTRICTION')); |
|
| 52 | + } |
|
| 51 | 53 | |
| 52 | 54 | # Remove item |
| 53 | 55 | |
| 54 | 56 | if (Request::post('action') === 'remove') { |
| 55 | 57 | |
| 56 | - if (!$this->entity->remove()) return $ajax->error(Language::get(static::$message_error_remove)); |
|
| 58 | + if (!$this->entity->remove()) { |
|
| 59 | + return $ajax->error(Language::get(static::$message_error_remove)); |
|
| 60 | + } |
|
| 57 | 61 | } |
| 58 | 62 | |
| 59 | 63 | # ------------------------ |
@@ -84,7 +88,9 @@ discard block |
||
| 84 | 88 | |
| 85 | 89 | # Handle ajax request |
| 86 | 90 | |
| 87 | - if (Request::isAjax()) return $this->handleAjax(); |
|
| 91 | + if (Request::isAjax()) { |
|
| 92 | + return $this->handleAjax(); |
|
| 93 | + } |
|
| 88 | 94 | |
| 89 | 95 | # Create form |
| 90 | 96 | |
@@ -101,7 +107,9 @@ discard block |
||
| 101 | 107 | |
| 102 | 108 | # Display success message |
| 103 | 109 | |
| 104 | - if (false !== Request::get('submitted')) Messages::success(Language::get(static::$message_success_rename)); |
|
| 110 | + if (false !== Request::get('submitted')) { |
|
| 111 | + Messages::success(Language::get(static::$message_success_rename)); |
|
| 112 | + } |
|
| 105 | 113 | |
| 106 | 114 | # ------------------------ |
| 107 | 115 | |
@@ -10,19 +10,33 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | private static function translateError(int $error) { |
| 12 | 12 | |
| 13 | - if ($error === UPLOAD_ERR_INI_SIZE) return 'UPLOADER_ERROR_INI_SIZE'; |
|
| 13 | + if ($error === UPLOAD_ERR_INI_SIZE) { |
|
| 14 | + return 'UPLOADER_ERROR_INI_SIZE'; |
|
| 15 | + } |
|
| 14 | 16 | |
| 15 | - if ($error === UPLOAD_ERR_FORM_SIZE) return 'UPLOADER_ERROR_FORM_SIZE'; |
|
| 17 | + if ($error === UPLOAD_ERR_FORM_SIZE) { |
|
| 18 | + return 'UPLOADER_ERROR_FORM_SIZE'; |
|
| 19 | + } |
|
| 16 | 20 | |
| 17 | - if ($error === UPLOAD_ERR_PARTIAL) return 'UPLOADER_ERROR_PARTIAL'; |
|
| 21 | + if ($error === UPLOAD_ERR_PARTIAL) { |
|
| 22 | + return 'UPLOADER_ERROR_PARTIAL'; |
|
| 23 | + } |
|
| 18 | 24 | |
| 19 | - if ($error === UPLOAD_ERR_NO_FILE) return 'UPLOADER_ERROR_NO_FILE'; |
|
| 25 | + if ($error === UPLOAD_ERR_NO_FILE) { |
|
| 26 | + return 'UPLOADER_ERROR_NO_FILE'; |
|
| 27 | + } |
|
| 20 | 28 | |
| 21 | - if ($error === UPLOAD_ERR_NO_TMP_DIR) return 'UPLOADER_ERROR_NO_TMP_DIR'; |
|
| 29 | + if ($error === UPLOAD_ERR_NO_TMP_DIR) { |
|
| 30 | + return 'UPLOADER_ERROR_NO_TMP_DIR'; |
|
| 31 | + } |
|
| 22 | 32 | |
| 23 | - if ($error === UPLOAD_ERR_CANT_WRITE) return 'UPLOADER_ERROR_CANT_WRITE'; |
|
| 33 | + if ($error === UPLOAD_ERR_CANT_WRITE) { |
|
| 34 | + return 'UPLOADER_ERROR_CANT_WRITE'; |
|
| 35 | + } |
|
| 24 | 36 | |
| 25 | - if ($error === UPLOAD_ERR_EXTENSION) return 'UPLOADER_ERROR_EXTENSION'; |
|
| 37 | + if ($error === UPLOAD_ERR_EXTENSION) { |
|
| 38 | + return 'UPLOADER_ERROR_EXTENSION'; |
|
| 39 | + } |
|
| 26 | 40 | |
| 27 | 41 | # ------------------------ |
| 28 | 42 | |
@@ -33,39 +47,55 @@ discard block |
||
| 33 | 47 | |
| 34 | 48 | public static function save(string $name, string $dir_name) { |
| 35 | 49 | |
| 36 | - if ((false === ($file = Request::file($name))) || !is_uploaded_file($file['tmp_name'])) return false; |
|
| 50 | + if ((false === ($file = Request::file($name))) || !is_uploaded_file($file['tmp_name'])) { |
|
| 51 | + return false; |
|
| 52 | + } |
|
| 37 | 53 | |
| 38 | 54 | # Check for demo mode |
| 39 | 55 | |
| 40 | - if (Informer::isDemoMode()) return 'DEMO_MODE_RESTRICTION'; |
|
| 56 | + if (Informer::isDemoMode()) { |
|
| 57 | + return 'DEMO_MODE_RESTRICTION'; |
|
| 58 | + } |
|
| 41 | 59 | |
| 42 | 60 | # Check for upload errors |
| 43 | 61 | |
| 44 | - if ($file['error'] !== UPLOAD_ERR_OK) return self::translateError($file['error']); |
|
| 62 | + if ($file['error'] !== UPLOAD_ERR_OK) { |
|
| 63 | + return self::translateError($file['error']); |
|
| 64 | + } |
|
| 45 | 65 | |
| 46 | 66 | # Check size |
| 47 | 67 | |
| 48 | - if ($file['size'] > CONFIG_UPLOADS_MAX_SIZE) return 'UPLOADER_ERROR_SIZE'; |
|
| 68 | + if ($file['size'] > CONFIG_UPLOADS_MAX_SIZE) { |
|
| 69 | + return 'UPLOADER_ERROR_SIZE'; |
|
| 70 | + } |
|
| 49 | 71 | |
| 50 | 72 | # Check file extension |
| 51 | 73 | |
| 52 | 74 | $extensions = ['php', 'phtml', 'php3', 'php4', 'php5', 'phps']; |
| 53 | 75 | |
| 54 | - if (in_array(Explorer::extension($file['name'], false), $extensions)) return 'UPLOADER_ERROR_TYPE'; |
|
| 76 | + if (in_array(Explorer::extension($file['name'], false), $extensions)) { |
|
| 77 | + return 'UPLOADER_ERROR_TYPE'; |
|
| 78 | + } |
|
| 55 | 79 | |
| 56 | 80 | # Check target directory |
| 57 | 81 | |
| 58 | - if (!Explorer::isDir($dir_name)) return 'UPLOADER_ERROR_DIR'; |
|
| 82 | + if (!Explorer::isDir($dir_name)) { |
|
| 83 | + return 'UPLOADER_ERROR_DIR'; |
|
| 84 | + } |
|
| 59 | 85 | |
| 60 | 86 | # Check target file |
| 61 | 87 | |
| 62 | 88 | $file_name = ($dir_name . '/' . basename($file['name'])); |
| 63 | 89 | |
| 64 | - if (Explorer::isDir($file_name) || Explorer::isFile($file_name)) return 'UPLOADER_ERROR_EXISTS'; |
|
| 90 | + if (Explorer::isDir($file_name) || Explorer::isFile($file_name)) { |
|
| 91 | + return 'UPLOADER_ERROR_EXISTS'; |
|
| 92 | + } |
|
| 65 | 93 | |
| 66 | 94 | # Save uploaded file |
| 67 | 95 | |
| 68 | - if (!@move_uploaded_file($file['tmp_name'], $file_name)) return 'UPLOADER_ERROR_SAVE'; |
|
| 96 | + if (!@move_uploaded_file($file['tmp_name'], $file_name)) { |
|
| 97 | + return 'UPLOADER_ERROR_SAVE'; |
|
| 98 | + } |
|
| 69 | 99 | |
| 70 | 100 | # ------------------------ |
| 71 | 101 | |
@@ -2,7 +2,11 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Utils { |
| 4 | 4 | |
| 5 | - use Modules\Informer, Utils\Messages, Explorer, Language, Request; |
|
| 5 | + use Modules\Informer; |
|
| 6 | + use Utils\Messages; |
|
| 7 | + use Explorer; |
|
| 8 | + use Language; |
|
| 9 | + use Request; |
|
| 6 | 10 | |
| 7 | 11 | abstract class Uploader { |
| 8 | 12 | |
@@ -2,7 +2,13 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Modules\Auth\Utils { |
| 4 | 4 | |
| 5 | - use Modules\Auth, Modules\Entitizer, Modules\Settings, Utils\View, Date, Language, Mailer; |
|
| 5 | + use Modules\Auth; |
|
| 6 | + use Modules\Entitizer; |
|
| 7 | + use Modules\Settings; |
|
| 8 | + use Utils\View; |
|
| 9 | + use Date; |
|
| 10 | + use Language; |
|
| 11 | + use Mailer; |
|
| 6 | 12 | |
| 7 | 13 | abstract class Mail { |
| 8 | 14 | |
@@ -2,7 +2,9 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Modules\Entitizer\Form { |
| 4 | 4 | |
| 5 | - use Modules\Entitizer, Utils\Form, Utils\Lister; |
|
| 5 | + use Modules\Entitizer; |
|
| 6 | + use Utils\Form; |
|
| 7 | + use Utils\Lister; |
|
| 6 | 8 | |
| 7 | 9 | class Page extends Form { |
| 8 | 10 | |
@@ -2,7 +2,13 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Modules\Entitizer\Form { |
| 4 | 4 | |
| 5 | - use Modules\Auth, Modules\Entitizer, Utils\Form, Utils\Lister, Geo\Country, Geo\Timezone, Language; |
|
| 5 | + use Modules\Auth; |
|
| 6 | + use Modules\Entitizer; |
|
| 7 | + use Utils\Form; |
|
| 8 | + use Utils\Lister; |
|
| 9 | + use Geo\Country; |
|
| 10 | + use Geo\Timezone; |
|
| 11 | + use Language; |
|
| 6 | 12 | |
| 7 | 13 | class User extends Form { |
| 8 | 14 | |
@@ -2,7 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Modules\Entitizer\Form { |
| 4 | 4 | |
| 5 | - use Modules\Entitizer, Utils\Form; |
|
| 5 | + use Modules\Entitizer; |
|
| 6 | + use Utils\Form; |
|
| 6 | 7 | |
| 7 | 8 | class Widget extends Form { |
| 8 | 9 | |
@@ -2,7 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Modules\Entitizer\Listview { |
| 4 | 4 | |
| 5 | - use Modules\Entitizer, Template; |
|
| 5 | + use Modules\Entitizer; |
|
| 6 | + use Template; |
|
| 6 | 7 | |
| 7 | 8 | class Variables extends Entitizer\Utils\Listview { |
| 8 | 9 | |
@@ -2,7 +2,9 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Modules\Entitizer\Listview { |
| 4 | 4 | |
| 5 | - use Modules\Entitizer, Template, Language; |
|
| 5 | + use Modules\Entitizer; |
|
| 6 | + use Template; |
|
| 7 | + use Language; |
|
| 6 | 8 | |
| 7 | 9 | class Widgets extends Entitizer\Utils\Listview { |
| 8 | 10 | |
@@ -2,7 +2,9 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Modules\Filemanager\Handler { |
| 4 | 4 | |
| 5 | - use Modules\Filemanager, Date, Template; |
|
| 5 | + use Modules\Filemanager; |
|
| 6 | + use Date; |
|
| 7 | + use Template; |
|
| 6 | 8 | |
| 7 | 9 | class Dir extends Filemanager\Utils\Handler { |
| 8 | 10 | |