Passed
Push — 0.4.0 ( cba0fe...bc0e2e )
by Anton
03:10
created
www/engine/System/Classes/Utils/Uploader.php 1 patch
Braces   +45 added lines, -15 removed lines patch added patch discarded remove patch
@@ -10,19 +10,33 @@  discard block
 block discarded – undo
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,19 +47,27 @@  discard block
 block discarded – undo
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 (MODE_DEMO) return 'DEMO_MODE_RESTRICTION';
56
+			if (MODE_DEMO) {
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
 
@@ -53,21 +75,29 @@  discard block
 block discarded – undo
53 75
 
54 76
 			$extension = strtolower(Explorer::getExtension($file['name'], false));
55 77
 
56
-			if (in_array($extension, $extensions, true)) return 'UPLOADER_ERROR_TYPE';
78
+			if (in_array($extension, $extensions, true)) {
79
+				return 'UPLOADER_ERROR_TYPE';
80
+			}
57 81
 
58 82
 			# Check target directory
59 83
 
60
-			if (!Explorer::isDir($dir_name)) return 'UPLOADER_ERROR_DIR';
84
+			if (!Explorer::isDir($dir_name)) {
85
+				return 'UPLOADER_ERROR_DIR';
86
+			}
61 87
 
62 88
 			# Check target file
63 89
 
64 90
 			$file_name = ($dir_name . '/' . basename($file['name']));
65 91
 
66
-			if (Explorer::isDir($file_name) || Explorer::isFile($file_name)) return 'UPLOADER_ERROR_EXISTS';
92
+			if (Explorer::isDir($file_name) || Explorer::isFile($file_name)) {
93
+				return 'UPLOADER_ERROR_EXISTS';
94
+			}
67 95
 
68 96
 			# Save uploaded file
69 97
 
70
-			if (!@move_uploaded_file($file['tmp_name'], $file_name)) return 'UPLOADER_ERROR_SAVE';
98
+			if (!@move_uploaded_file($file['tmp_name'], $file_name)) {
99
+				return 'UPLOADER_ERROR_SAVE';
100
+			}
71 101
 
72 102
 			# ------------------------
73 103
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Filemanager/Utils/Handler.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,7 +47,9 @@  discard block
 block discarded – undo
47 47
 
48 48
 			# Check for demo mode
49 49
 
50
-			if (MODE_DEMO) return $ajax->setError(Language::get('DEMO_MODE_RESTRICTION'));
50
+			if (MODE_DEMO) {
51
+				return $ajax->setError(Language::get('DEMO_MODE_RESTRICTION'));
52
+			}
51 53
 
52 54
 			# Init entity
53 55
 
@@ -60,7 +62,9 @@  discard block
 block discarded – undo
60 62
 
61 63
 			if (Request::post('action') === 'remove') {
62 64
 
63
-				if (!$this->entity->remove()) return $ajax->setError(Language::get(static::$message_error_remove));
65
+				if (!$this->entity->remove()) {
66
+					return $ajax->setError(Language::get(static::$message_error_remove));
67
+				}
64 68
 			}
65 69
 
66 70
 			# ------------------------
@@ -82,7 +86,9 @@  discard block
 block discarded – undo
82 86
 
83 87
 			# Handle ajax request
84 88
 
85
-			if (Request::isAjax()) return $this->handleAjax();
89
+			if (Request::isAjax()) {
90
+				return $this->handleAjax();
91
+			}
86 92
 
87 93
 			# Init entity
88 94
 
@@ -108,7 +114,9 @@  discard block
 block discarded – undo
108 114
 
109 115
 			# Display success message
110 116
 
111
-			if (false !== Request::get('submitted')) Popup::set('positive', Language::get(static::$message_success_rename));
117
+			if (false !== Request::get('submitted')) {
118
+				Popup::set('positive', Language::get(static::$message_success_rename));
119
+			}
112 120
 
113 121
 			# ------------------------
114 122
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Filemanager/Controller/Create.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,23 +29,31 @@
 block discarded – undo
29 29
 
30 30
 			# Check for demo mode
31 31
 
32
-			if (MODE_DEMO) return 'DEMO_MODE_RESTRICTION';
32
+			if (MODE_DEMO) {
33
+				return 'DEMO_MODE_RESTRICTION';
34
+			}
33 35
 
34 36
 			# Validate name
35 37
 
36
-			if (false === ($name = Validate::fileName($name))) return ['name', 'FILEMANAGER_ERROR_NAME_INVALID'];
38
+			if (false === ($name = Validate::fileName($name))) {
39
+				return ['name', 'FILEMANAGER_ERROR_NAME_INVALID'];
40
+			}
37 41
 
38 42
 			# Check if item exists
39 43
 
40
-			if (@file_exists($this->parent->pathFull() . $name)) return ['name', 'FILEMANAGER_ERROR_EXISTS'];
44
+			if (@file_exists($this->parent->pathFull() . $name)) {
45
+				return ['name', 'FILEMANAGER_ERROR_EXISTS'];
46
+			}
41 47
 
42 48
 			# Create item
43 49
 
44 50
 			$entity = Filemanager::get($type, $this->parent);
45 51
 
46
-			if (!$entity->create($name)) return (($entity->type() === FILEMANAGER_TYPE_DIR) ?
52
+			if (!$entity->create($name)) {
53
+				return (($entity->type() === FILEMANAGER_TYPE_DIR) ?
47 54
 
48 55
 				'FILEMANAGER_ERROR_DIR_CREATE' : 'FILEMANAGER_ERROR_FILE_CREATE');
56
+			}
49 57
 
50 58
 			# ------------------------
51 59
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Filemanager/Controller/Rename.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,23 +29,31 @@
 block discarded – undo
29 29
 
30 30
 			# Check for demo mode
31 31
 
32
-			if (MODE_DEMO) return 'DEMO_MODE_RESTRICTION';
32
+			if (MODE_DEMO) {
33
+				return 'DEMO_MODE_RESTRICTION';
34
+			}
33 35
 
34 36
 			# Validate name
35 37
 
36
-			if (false === ($name = Validate::fileName($name))) return ['name', 'FILEMANAGER_ERROR_NAME_INVALID'];
38
+			if (false === ($name = Validate::fileName($name))) {
39
+				return ['name', 'FILEMANAGER_ERROR_NAME_INVALID'];
40
+			}
37 41
 
38 42
 			# Check if item exists
39 43
 
40 44
 			if ((0 !== strcasecmp($this->entity->name(), $name)) &&
41 45
 
42
-				@file_exists($this->entity->parent()->pathFull() . $name)) return ['name', 'FILEMANAGER_ERROR_EXISTS'];
46
+				@file_exists($this->entity->parent()->pathFull() . $name)) {
47
+				return ['name', 'FILEMANAGER_ERROR_EXISTS'];
48
+			}
43 49
 
44 50
 			# Rename item
45 51
 
46
-			if (!$this->entity->rename($name)) return (($this->entity->type() === FILEMANAGER_TYPE_DIR) ?
52
+			if (!$this->entity->rename($name)) {
53
+				return (($this->entity->type() === FILEMANAGER_TYPE_DIR) ?
47 54
 
48 55
 				'FILEMANAGER_ERROR_DIR_RENAME' : 'FILEMANAGER_ERROR_FILE_RENAME');
56
+			}
49 57
 
50 58
 			# ------------------------
51 59
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Settings/Controller/General.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
12 12
 
13 13
 			# Check for demo mode
14 14
 
15
-			if (MODE_DEMO) return 'DEMO_MODE_RESTRICTION';
15
+			if (MODE_DEMO) {
16
+				return 'DEMO_MODE_RESTRICTION';
17
+			}
16 18
 
17 19
 			# Define errors list
18 20
 
@@ -25,12 +27,16 @@  discard block
 block discarded – undo
25 27
 
26 28
 			foreach (Settings::setArray($post) as $name => $result) {
27 29
 
28
-				if (!$result) return (isset($errors[$name]) ? [$name, $errors[$name]] : false);
30
+				if (!$result) {
31
+					return (isset($errors[$name]) ? [$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
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Extend/Utils/Handler/Basic.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,13 +30,19 @@  discard block
 block discarded – undo
30 30
 
31 31
 			if (Request::post('action') === 'activate') {
32 32
 
33
-				if (MODE_DEMO) return $ajax->setError(Language::get('DEMO_MODE_RESTRICTION'));
33
+				if (MODE_DEMO) {
34
+					return $ajax->setError(Language::get('DEMO_MODE_RESTRICTION'));
35
+				}
34 36
 
35 37
 				$param = static::$param[$this->loader->section()]; $name = Request::post('name');
36 38
 
37
-				if (false === Settings::set($param, $name)) return $ajax->setError(Language::get(static::$error_activate));
39
+				if (false === Settings::set($param, $name)) {
40
+					return $ajax->setError(Language::get(static::$error_activate));
41
+				}
38 42
 
39
-				if (false === Settings::save()) return $ajax->setError(Language::get(static::$error_save));
43
+				if (false === Settings::save()) {
44
+					return $ajax->setError(Language::get(static::$error_save));
45
+				}
40 46
 
41 47
 			} else if (Request::post('action') === 'list') {
42 48
 
@@ -54,7 +60,9 @@  discard block
 block discarded – undo
54 60
 
55 61
 			$this->loader = new static::$loader_class(Request::get('list'));
56 62
 
57
-			if (Request::isAjax()) return $this->handleAjax();
63
+			if (Request::isAjax()) {
64
+				return $this->handleAjax();
65
+			}
58 66
 
59 67
 			# ------------------------
60 68
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Controller/Variable.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,13 +29,19 @@  discard block
 block discarded – undo
29 29
 
30 30
 			# Validate name
31 31
 
32
-			if (false === ($name = Validate::templateComponentName($name))) return ['name', 'VARIABLE_ERROR_NAME_INVALID'];
32
+			if (false === ($name = Validate::templateComponentName($name))) {
33
+				return ['name', 'VARIABLE_ERROR_NAME_INVALID'];
34
+			}
33 35
 
34 36
 			# Check name exists
35 37
 
36
-			if (false === ($check_name = $this->variable->check($name, 'name'))) return 'VARIABLE_ERROR_MODIFY';
38
+			if (false === ($check_name = $this->variable->check($name, 'name'))) {
39
+				return 'VARIABLE_ERROR_MODIFY';
40
+			}
37 41
 
38
-			if ($check_name === 1) return ['name', 'VARIABLE_ERROR_NAME_DUPLICATE'];
42
+			if ($check_name === 1) {
43
+				return ['name', 'VARIABLE_ERROR_NAME_DUPLICATE'];
44
+			}
39 45
 
40 46
 			# Modify variable
41 47
 
@@ -47,7 +53,9 @@  discard block
 block discarded – undo
47 53
 
48 54
 			$modifier = ((0 === $this->variable->id) ? 'create' : 'edit');
49 55
 
50
-			if (!$this->variable->$modifier($data)) return 'VARIABLE_ERROR_MODIFY';
56
+			if (!$this->variable->$modifier($data)) {
57
+				return 'VARIABLE_ERROR_MODIFY';
58
+			}
51 59
 
52 60
 			# ------------------------
53 61
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Controller/Widget.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,13 +29,19 @@  discard block
 block discarded – undo
29 29
 
30 30
 			# Validate name
31 31
 
32
-			if (false === ($name = Validate::templateComponentName($name))) return ['name', 'WIDGET_ERROR_NAME_INVALID'];
32
+			if (false === ($name = Validate::templateComponentName($name))) {
33
+				return ['name', 'WIDGET_ERROR_NAME_INVALID'];
34
+			}
33 35
 
34 36
 			# Check name exists
35 37
 
36
-			if (false === ($check_name = $this->widget->check($name, 'name'))) return 'WIDGET_ERROR_MODIFY';
38
+			if (false === ($check_name = $this->widget->check($name, 'name'))) {
39
+				return 'WIDGET_ERROR_MODIFY';
40
+			}
37 41
 
38
-			if ($check_name === 1) return ['name', 'WIDGET_ERROR_NAME_DUPLICATE'];
42
+			if ($check_name === 1) {
43
+				return ['name', 'WIDGET_ERROR_NAME_DUPLICATE'];
44
+			}
39 45
 
40 46
 			# Modify widget
41 47
 
@@ -48,7 +54,9 @@  discard block
 block discarded – undo
48 54
 
49 55
 			$modifier = ((0 === $this->widget->id) ? 'create' : 'edit');
50 56
 
51
-			if (!$this->widget->$modifier($data)) return 'WIDGET_ERROR_MODIFY';
57
+			if (!$this->widget->$modifier($data)) {
58
+				return 'WIDGET_ERROR_MODIFY';
59
+			}
52 60
 
53 61
 			# ------------------------
54 62
 
Please login to merge, or discard this patch.