Passed
Pull Request — master (#11)
by Anton
03:24
created
www/engine/System/Classes/Utils/Uploader.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
 
60 60
 			# Check target file
61 61
 
62
-			$file_name = ($dir_name . '/' . basename($file['name']));
62
+			$file_name = ($dir_name.'/'.basename($file['name']));
63 63
 
64 64
 			if (Explorer::isDir($file_name) || Explorer::isFile($file_name)) return 'UPLOADER_ERROR_EXISTS';
65 65
 
Please login to merge, or discard this 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 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
 
89 89
 			if (!$this->entity->init(Request::get('name'))) {
90 90
 
91
-				$query = (('' !== $this->parent->path()) ? ('?parent=' . $this->parent->path()) : '');
91
+				$query = (('' !== $this->parent->path()) ? ('?parent='.$this->parent->path()) : '');
92 92
 
93
-				Request::redirect(INSTALL_PATH . '/admin/content/filemanager' . $query);
93
+				Request::redirect(INSTALL_PATH.'/admin/content/filemanager'.$query);
94 94
 			}
95 95
 
96 96
 			# Create form
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 
102 102
 			if ($this->form->handle(new Filemanager\Controller\Rename($this->entity))) {
103 103
 
104
-				$query = ('?parent=' . $this->parent->path() . '&name=' . $this->entity->name() . '&submitted');
104
+				$query = ('?parent='.$this->parent->path().'&name='.$this->entity->name().'&submitted');
105 105
 
106
-				Request::redirect(INSTALL_PATH . '/admin/content/filemanager/' . static::$type . $query);
106
+				Request::redirect(INSTALL_PATH.'/admin/content/filemanager/'.static::$type.$query);
107 107
 			}
108 108
 
109 109
 			# Display success message
Please login to merge, or discard this 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/Entitizer/Utils/Handler.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
 
62 62
 			# Set link
63 63
 
64
-			$link = (INSTALL_PATH . static::$link . '/');
64
+			$link = (INSTALL_PATH.static::$link.'/');
65 65
 
66
-			if (static::$nesting) $contents->link = ($link . ($this->create ? 'create' : 'edit') . '?id=' . $this->parent->id);
66
+			if (static::$nesting) $contents->link = ($link.($this->create ? 'create' : 'edit').'?id='.$this->parent->id);
67 67
 
68
-			else $contents->link = ($link . ($this->create ? 'create' : ('edit?id=' . $this->entity->id)));
68
+			else $contents->link = ($link.($this->create ? 'create' : ('edit?id='.$this->entity->id)));
69 69
 
70 70
 			# Process parent block
71 71
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
 			# Redirect if entity not found
126 126
 
127
-			if (!$this->create && (0 === $this->entity->id)) return Request::redirect(INSTALL_PATH . static::$link);
127
+			if (!$this->create && (0 === $this->entity->id)) return Request::redirect(INSTALL_PATH.static::$link);
128 128
 
129 129
 			# Create form
130 130
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
 			if ($this->form->handle(new static::$controller($this->entity))) {
138 138
 
139
-				Request::redirect(INSTALL_PATH . static::$link . '/edit?id=' . $this->entity->id . '&submitted');
139
+				Request::redirect(INSTALL_PATH.static::$link.'/edit?id='.$this->entity->id.'&submitted');
140 140
 			}
141 141
 
142 142
 			# Display success message
Please login to merge, or discard this patch.
Braces   +37 added lines, -15 removed lines patch added patch discarded remove patch
@@ -45,7 +45,9 @@  discard block
 block discarded – undo
45 45
 
46 46
 		private function processSelector(Template\Block $selector) {
47 47
 
48
-			if ($this->create) return $selector->disable();
48
+			if ($this->create) {
49
+				return $selector->disable();
50
+			}
49 51
 
50 52
 			$selector->parent_id = $this->entity->parent_id;
51 53
 
@@ -68,25 +70,33 @@  discard block
 block discarded – undo
68 70
 
69 71
 			# Set path / title
70 72
 
71
-			if (static::$nesting) $contents->path = $this->path;
72
-
73
-			else $contents->title = ($this->create ? Language::get(static::$naming_new) : $this->entity->get(static::$naming));
73
+			if (static::$nesting) {
74
+				$contents->path = $this->path;
75
+			} else {
76
+				$contents->title = ($this->create ? Language::get(static::$naming_new) : $this->entity->get(static::$naming));
77
+			}
74 78
 
75 79
 			# Process parent block
76 80
 
77
-			if (static::$nesting) $this->processParent($contents->getBlock('parent'));
81
+			if (static::$nesting) {
82
+				$this->processParent($contents->getBlock('parent'));
83
+			}
78 84
 
79 85
 			# Set link
80 86
 
81 87
 			$link = (INSTALL_PATH . static::$link . '/');
82 88
 
83
-			if (static::$nesting) $contents->link = ($link . ($this->create ? 'create' : 'edit') . '?id=' . $this->parent->id);
84
-
85
-			else $contents->link = ($link . ($this->create ? 'create' : ('edit?id=' . $this->entity->id)));
89
+			if (static::$nesting) {
90
+				$contents->link = ($link . ($this->create ? 'create' : 'edit') . '?id=' . $this->parent->id);
91
+			} else {
92
+				$contents->link = ($link . ($this->create ? 'create' : ('edit?id=' . $this->entity->id)));
93
+			}
86 94
 
87 95
 			# Process selector block
88 96
 
89
-			if (static::$nesting) $this->processSelector($contents->getBlock('selector'));
97
+			if (static::$nesting) {
98
+				$this->processSelector($contents->getBlock('selector'));
99
+			}
90 100
 
91 101
 			# Implement form
92 102
 
@@ -119,11 +129,15 @@  discard block
 block discarded – undo
119 129
 
120 130
 				$parent_id = Number::forceInt(Request::post('parent_id'));
121 131
 
122
-				if (!$this->entity->move($parent_id)) return $ajax->setError(Language::get(static::$message_error_move));
132
+				if (!$this->entity->move($parent_id)) {
133
+					return $ajax->setError(Language::get(static::$message_error_move));
134
+				}
123 135
 
124 136
 			} else if (Request::post('action') === 'remove') {
125 137
 
126
-				if (!$this->entity->remove()) return $ajax->setError(Language::get(static::$message_error_remove));
138
+				if (!$this->entity->remove()) {
139
+					return $ajax->setError(Language::get(static::$message_error_remove));
140
+				}
127 141
 			}
128 142
 
129 143
 			# ------------------------
@@ -135,7 +149,9 @@  discard block
 block discarded – undo
135 149
 
136 150
 		protected function handle() {
137 151
 
138
-			if (!$this->create && Request::isAjax()) return $this->handleAjax();
152
+			if (!$this->create && Request::isAjax()) {
153
+				return $this->handleAjax();
154
+			}
139 155
 
140 156
 			# Create entity
141 157
 
@@ -143,7 +159,9 @@  discard block
 block discarded – undo
143 159
 
144 160
 			$this->entity = Entitizer::get(static::$table, (!$this->create ? $id : 0));
145 161
 
146
-			if (!$this->create && (0 === $this->entity->id)) return Request::redirect(INSTALL_PATH . static::$link);
162
+			if (!$this->create && (0 === $this->entity->id)) {
163
+				return Request::redirect(INSTALL_PATH . static::$link);
164
+			}
147 165
 
148 166
 			# Create parent entity
149 167
 
@@ -151,7 +169,9 @@  discard block
 block discarded – undo
151 169
 
152 170
 			# Get path
153 171
 
154
-			if (false !== ($path = $this->parent->path())) $this->path = $path;
172
+			if (false !== ($path = $this->parent->path())) {
173
+				$this->path = $path;
174
+			}
155 175
 
156 176
 			# Create form
157 177
 
@@ -161,7 +181,9 @@  discard block
 block discarded – undo
161 181
 
162 182
 			if ($this->form->handle(new static::$controller($this->entity), true)) {
163 183
 
164
-				if ($this->create && (0 !== $this->parent->id)) $this->entity->move($this->parent->id);
184
+				if ($this->create && (0 !== $this->parent->id)) {
185
+					$this->entity->move($this->parent->id);
186
+				}
165 187
 
166 188
 				Request::redirect(INSTALL_PATH . static::$link . '/edit?id=' . $this->entity->id . '&submitted');
167 189
 			}
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Settings/Handler/General.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 
36 36
 			if ($this->form->handle(new Settings\Controller\General())) {
37 37
 
38
-				Request::redirect(INSTALL_PATH . '/admin/system/settings?submitted');
38
+				Request::redirect(INSTALL_PATH.'/admin/system/settings?submitted');
39 39
 			}
40 40
 
41 41
 			# Display success message
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,9 @@
 block discarded – undo
40 40
 
41 41
 			# Display success message
42 42
 
43
-			if (false !== Request::get('submitted')) Popup::set('positive', Language::get('SETTINGS_SUCCESS'));
43
+			if (false !== Request::get('submitted')) {
44
+				Popup::set('positive', Language::get('SETTINGS_SUCCESS'));
45
+			}
44 46
 
45 47
 			# ------------------------
46 48
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Profile/Handler/Edit.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,9 @@
 block discarded – undo
50 50
 
51 51
 			# Display success message
52 52
 
53
-			if (false !== Request::get('submitted')) Messages::set('success', Language::get('USER_SUCCESS_EDIT'));
53
+			if (false !== Request::get('submitted')) {
54
+				Messages::set('success', Language::get('USER_SUCCESS_EDIT'));
55
+			}
54 56
 
55 57
 			# ------------------------
56 58
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Install/Handler/Database.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 
36 36
 			if ($this->form->handle(new Install\Controller\Database())) {
37 37
 
38
-				Request::redirect(INSTALL_PATH . '/admin/register');
38
+				Request::redirect(INSTALL_PATH.'/admin/register');
39 39
 			}
40 40
 
41 41
 			# ------------------------
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Install/Handler/Check.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 
19 19
 				$class = ($value ? 'positive' : 'negative'); $icon = ($value ? 'check circle' : 'warning circle');
20 20
 
21
-				$text = Language::get('INSTALL_REQUIREMENT_' . strtoupper($name) . '_' . ($value ? 'SUCCESS' : 'FAIL'));
21
+				$text = Language::get('INSTALL_REQUIREMENT_'.strtoupper($name).'_'.($value ? 'SUCCESS' : 'FAIL'));
22 22
 
23 23
 				$requirements[] = ['class' => $class, 'icon' => $icon, 'text' => $text];
24 24
 			}
Please login to merge, or discard this patch.
www/engine/Framework/Classes/DB/Query/Insert.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@
 block discarded – undo
24 24
 
25 25
 				if (0 === $key) $names = $this->getString(array_keys($row), '$name', ', ');
26 26
 
27
-				$values[] = ('(' . $this->getString(array_values($row), '$value', ', ') . ')');
27
+				$values[] = ('('.$this->getString(array_values($row), '$value', ', ').')');
28 28
 			}
29 29
 
30 30
 			# Build query
31 31
 
32
-			$this->query = ('INSERT ' . ($ignore ? 'IGNORE ' : '') .
32
+			$this->query = ('INSERT '.($ignore ? 'IGNORE ' : '').
33 33
 
34
-				'INTO ' . $table . ' (' . $names . ') VALUES ' . implode(', ', $values));
34
+				'INTO '.$table.' ('.$names.') VALUES '.implode(', ', $values));
35 35
 		}
36 36
 	}
37 37
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,9 +29,11 @@
 block discarded – undo
29 29
 
30 30
 			$names = ''; $values = [];
31 31
 
32
-			foreach ($set as $key => $row) if (is_array($row)) {
32
+			foreach ($set as $key => $row) {
33
+				if (is_array($row)) {
33 34
 
34 35
 				if (0 === $key) $names = $this->getString(array_keys($row), '$name', ', ');
36
+			}
35 37
 
36 38
 				$values[] = ('(' . $this->getString(array_values($row), '$value', ', ') . ')');
37 39
 			}
Please login to merge, or discard this patch.
www/engine/System/Includes/Tables.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -2,15 +2,15 @@
 block discarded – undo
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');
Please login to merge, or discard this patch.