Passed
Push — master ( c7e98d...e0d6a2 )
by Anton
04:56 queued 01:50
created
www/engine/System/Classes/Utils/Uploader.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
 
64 64
 			# Check target file
65 65
 
66
-			$base_name = basename($file['name']); $file_name = ($dir_name . '/' . $base_name);
66
+			$base_name = basename($file['name']); $file_name = ($dir_name.'/'.$base_name);
67 67
 
68 68
 			if (Explorer::isDir($file_name) || Explorer::isFile($file_name)) return 'UPLOADER_ERROR_EXISTS';
69 69
 
Please login to merge, or discard this patch.
Braces   +45 added lines, -15 removed lines patch added patch discarded remove patch
@@ -12,19 +12,33 @@  discard block
 block discarded – undo
12 12
 
13 13
 		private static function translateError(int $error) {
14 14
 
15
-			if ($error === UPLOAD_ERR_INI_SIZE)         return 'UPLOADER_ERROR_INI_SIZE';
15
+			if ($error === UPLOAD_ERR_INI_SIZE) {
16
+				return 'UPLOADER_ERROR_INI_SIZE';
17
+			}
16 18
 
17
-			if ($error === UPLOAD_ERR_FORM_SIZE)        return 'UPLOADER_ERROR_FORM_SIZE';
19
+			if ($error === UPLOAD_ERR_FORM_SIZE) {
20
+				return 'UPLOADER_ERROR_FORM_SIZE';
21
+			}
18 22
 
19
-			if ($error === UPLOAD_ERR_PARTIAL)          return 'UPLOADER_ERROR_PARTIAL';
23
+			if ($error === UPLOAD_ERR_PARTIAL) {
24
+				return 'UPLOADER_ERROR_PARTIAL';
25
+			}
20 26
 
21
-			if ($error === UPLOAD_ERR_NO_FILE)          return 'UPLOADER_ERROR_NO_FILE';
27
+			if ($error === UPLOAD_ERR_NO_FILE) {
28
+				return 'UPLOADER_ERROR_NO_FILE';
29
+			}
22 30
 
23
-			if ($error === UPLOAD_ERR_NO_TMP_DIR)       return 'UPLOADER_ERROR_NO_TMP_DIR';
31
+			if ($error === UPLOAD_ERR_NO_TMP_DIR) {
32
+				return 'UPLOADER_ERROR_NO_TMP_DIR';
33
+			}
24 34
 
25
-			if ($error === UPLOAD_ERR_CANT_WRITE)       return 'UPLOADER_ERROR_CANT_WRITE';
35
+			if ($error === UPLOAD_ERR_CANT_WRITE) {
36
+				return 'UPLOADER_ERROR_CANT_WRITE';
37
+			}
26 38
 
27
-			if ($error === UPLOAD_ERR_EXTENSION)        return 'UPLOADER_ERROR_EXTENSION';
39
+			if ($error === UPLOAD_ERR_EXTENSION) {
40
+				return 'UPLOADER_ERROR_EXTENSION';
41
+			}
28 42
 
29 43
 			# ------------------------
30 44
 
@@ -35,19 +49,27 @@  discard block
 block discarded – undo
35 49
 
36 50
 		public static function save(string $name, string $dir_name) {
37 51
 
38
-			if (false === ($file = Request::file($name))) return false;
52
+			if (false === ($file = Request::file($name))) {
53
+				return false;
54
+			}
39 55
 
40 56
 			# Check for upload errors
41 57
 
42
-			if ($file['error'] !== UPLOAD_ERR_OK) return self::translateError($file['error']);
58
+			if ($file['error'] !== UPLOAD_ERR_OK) {
59
+				return self::translateError($file['error']);
60
+			}
43 61
 
44 62
 			# Check for secure upload
45 63
 
46
-			if (!is_uploaded_file($file['tmp_name'])) return 'UPLOADER_ERROR_SECURITY';
64
+			if (!is_uploaded_file($file['tmp_name'])) {
65
+				return 'UPLOADER_ERROR_SECURITY';
66
+			}
47 67
 
48 68
 			# Check size
49 69
 
50
-			if ($file['size'] > CONFIG_UPLOADS_MAX_SIZE) return 'UPLOADER_ERROR_SIZE';
70
+			if ($file['size'] > CONFIG_UPLOADS_MAX_SIZE) {
71
+				return 'UPLOADER_ERROR_SIZE';
72
+			}
51 73
 
52 74
 			# Check file extension
53 75
 
@@ -55,21 +77,29 @@  discard block
 block discarded – undo
55 77
 
56 78
 			$extension = strtolower(Explorer::getExtension($file['name'], false));
57 79
 
58
-			if (in_array($extension, $extensions, true)) return 'UPLOADER_ERROR_TYPE';
80
+			if (in_array($extension, $extensions, true)) {
81
+				return 'UPLOADER_ERROR_TYPE';
82
+			}
59 83
 
60 84
 			# Check target directory
61 85
 
62
-			if (!Explorer::isDir($dir_name) && !Explorer::createDir($dir_name)) return 'UPLOADER_ERROR_DIR';
86
+			if (!Explorer::isDir($dir_name) && !Explorer::createDir($dir_name)) {
87
+				return 'UPLOADER_ERROR_DIR';
88
+			}
63 89
 
64 90
 			# Check target file
65 91
 
66 92
 			$base_name = basename($file['name']); $file_name = ($dir_name . '/' . $base_name);
67 93
 
68
-			if (Explorer::isDir($file_name) || Explorer::isFile($file_name)) return 'UPLOADER_ERROR_EXISTS';
94
+			if (Explorer::isDir($file_name) || Explorer::isFile($file_name)) {
95
+				return 'UPLOADER_ERROR_EXISTS';
96
+			}
69 97
 
70 98
 			# Save uploaded file
71 99
 
72
-			if (!@move_uploaded_file($file['tmp_name'], $file_name)) return 'UPLOADER_ERROR_SAVE';
100
+			if (!@move_uploaded_file($file['tmp_name'], $file_name)) {
101
+				return 'UPLOADER_ERROR_SAVE';
102
+			}
73 103
 
74 104
 			# Set upload data
75 105
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Filemanager/Handler/Upload.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@
 block discarded – undo
22 22
 
23 23
 			# Save uploaded file
24 24
 
25
-			if (true === ($upload = (Uploader::save('upload', (DIR_UPLOADS . $target_dir))))) {
25
+			if (true === ($upload = (Uploader::save('upload', (DIR_UPLOADS.$target_dir))))) {
26 26
 
27
-				$base_name = Uploader::baseName(); $url = (INSTALL_PATH . '/uploads/' . $target_dir . $base_name);
27
+				$base_name = Uploader::baseName(); $url = (INSTALL_PATH.'/uploads/'.$target_dir.$base_name);
28 28
 
29 29
 				$ajax->set('uploaded', 1)->set('fileName', $base_name)->set('url', $url);
30 30
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
 
11 11
 		protected function handle() {
12 12
 
13
-			if (!Request::isAjax()) return false;
13
+			if (!Request::isAjax()) {
14
+				return false;
15
+			}
14 16
 
15 17
 			# Create response
16 18
 
Please login to merge, or discard this patch.
www/engine/System/Includes/Constants.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -2,68 +2,68 @@
 block discarded – undo
2 2
 
3 3
 # Cadmium
4 4
 
5
-define('CADMIUM_NAME',                              'Cadmium CMS');
6
-define('CADMIUM_HOME',                              'http://cadmium-cms.com');
5
+define('CADMIUM_NAME', 'Cadmium CMS');
6
+define('CADMIUM_HOME', 'http://cadmium-cms.com');
7 7
 
8
-define('CADMIUM_VERSION',                           '0.4.2');
9
-define('CADMIUM_COPY',                              '2016');
8
+define('CADMIUM_VERSION', '0.4.2');
9
+define('CADMIUM_COPY', '2016');
10 10
 
11 11
 # External
12 12
 
13
-define('JQUERY_VERSION',                            '3.1.1');
14
-define('SEMANTIC_UI_VERSION',                       '2.2.6');
15
-define('CKEDITOR_VERSION',                          '4.6.0');
13
+define('JQUERY_VERSION', '3.1.1');
14
+define('SEMANTIC_UI_VERSION', '2.2.6');
15
+define('CKEDITOR_VERSION', '4.6.0');
16 16
 
17 17
 # Sections
18 18
 
19
-define('SECTION_ADMIN',                             'admin');
20
-define('SECTION_SITE',                              'site');
19
+define('SECTION_ADMIN', 'admin');
20
+define('SECTION_SITE', 'site');
21 21
 
22 22
 # Filemanager types
23 23
 
24
-define('FILEMANAGER_TYPE_DIR',                      'dir');
25
-define('FILEMANAGER_TYPE_FILE',                     'file');
24
+define('FILEMANAGER_TYPE_DIR', 'dir');
25
+define('FILEMANAGER_TYPE_FILE', 'file');
26 26
 
27 27
 # Access
28 28
 
29
-define('ACCESS_PUBLIC',                             0);
30
-define('ACCESS_REGISTERED',                         1);
31
-define('ACCESS_ADMINISTRATOR',                      2);
29
+define('ACCESS_PUBLIC', 0);
30
+define('ACCESS_REGISTERED', 1);
31
+define('ACCESS_ADMINISTRATOR', 2);
32 32
 
33 33
 # Frequency
34 34
 
35
-define('FREQUENCY_ALWAYS',                          'always');
36
-define('FREQUENCY_HOURLY',                          'hourly');
37
-define('FREQUENCY_DAILY',                           'daily');
38
-define('FREQUENCY_WEEKLY',                          'weekly');
39
-define('FREQUENCY_MONTHLY',                         'monthly');
40
-define('FREQUENCY_YEARLY',                          'yearly');
41
-define('FREQUENCY_NEVER',                           'never');
35
+define('FREQUENCY_ALWAYS', 'always');
36
+define('FREQUENCY_HOURLY', 'hourly');
37
+define('FREQUENCY_DAILY', 'daily');
38
+define('FREQUENCY_WEEKLY', 'weekly');
39
+define('FREQUENCY_MONTHLY', 'monthly');
40
+define('FREQUENCY_YEARLY', 'yearly');
41
+define('FREQUENCY_NEVER', 'never');
42 42
 
43 43
 # Rank
44 44
 
45
-define('RANK_GUEST',                                0);
46
-define('RANK_USER',                                 1);
47
-define('RANK_ADMINISTRATOR',                        2);
45
+define('RANK_GUEST', 0);
46
+define('RANK_USER', 1);
47
+define('RANK_ADMINISTRATOR', 2);
48 48
 
49 49
 # Sex
50 50
 
51
-define('SEX_NOT_SELECTED',                          0);
52
-define('SEX_MALE',                                  1);
53
-define('SEX_FEMALE',                                2);
51
+define('SEX_NOT_SELECTED', 0);
52
+define('SEX_MALE', 1);
53
+define('SEX_FEMALE', 2);
54 54
 
55 55
 # Status
56 56
 
57
-define('STATUS_ONLINE',                             0);
58
-define('STATUS_MAINTENANCE',                        1);
59
-define('STATUS_UPDATE',                             2);
57
+define('STATUS_ONLINE', 0);
58
+define('STATUS_MAINTENANCE', 1);
59
+define('STATUS_UPDATE', 2);
60 60
 
61 61
 # Target
62 62
 
63
-define('TARGET_SELF',                               0);
64
-define('TARGET_BLANK',                              1);
63
+define('TARGET_SELF', 0);
64
+define('TARGET_BLANK', 1);
65 65
 
66 66
 # Visibility
67 67
 
68
-define('VISIBILITY_DRAFT',                          0);
69
-define('VISIBILITY_PUBLISHED',                      1);
68
+define('VISIBILITY_DRAFT', 0);
69
+define('VISIBILITY_PUBLISHED', 1);
Please login to merge, or discard this patch.