Completed
Push — master ( e7c824...3ed60a )
by Anton
10s
created
www/engine/System/Classes/Modules/Auth/Controller/Reset.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
22 24
 
23 25
 			# Validate values
24 26
 
25
-			if (false === ($name = Validate::userName($name))) return 'USER_ERROR_NAME_INVALID';
27
+			if (false === ($name = Validate::userName($name))) {
28
+				return 'USER_ERROR_NAME_INVALID';
29
+			}
26 30
 
27
-			if (false === Security::checkCaptcha($captcha)) return 'USER_ERROR_CAPTCHA_INCORRECT';
31
+			if (false === Security::checkCaptcha($captcha)) {
32
+				return 'USER_ERROR_CAPTCHA_INCORRECT';
33
+			}
28 34
 
29 35
 			# Create user object
30 36
 
@@ -32,13 +38,19 @@  discard block
 block discarded – undo
32 38
 
33 39
 			# Init user
34 40
 
35
-			if (!$user->init($name, 'name')) return 'USER_ERROR_NAME_INCORRECT';
41
+			if (!$user->init($name, 'name')) {
42
+				return 'USER_ERROR_NAME_INCORRECT';
43
+			}
36 44
 
37
-			if (Auth::admin() && ($user->rank < RANK_ADMINISTRATOR)) return 'USER_ERROR_NAME_INCORRECT';
45
+			if (Auth::admin() && ($user->rank < RANK_ADMINISTRATOR)) {
46
+				return '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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Auth/Controller/Login.php 1 patch
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
22 24
 
23 25
 			# Validate values
24 26
 
25
-			if (false === ($name = Validate::userName($name))) return 'USER_ERROR_NAME_INVALID';
27
+			if (false === ($name = Validate::userName($name))) {
28
+				return 'USER_ERROR_NAME_INVALID';
29
+			}
26 30
 
27
-			if (false === ($password = Validate::userPassword($password))) return 'USER_ERROR_PASSWORD_INVALID';
31
+			if (false === ($password = Validate::userPassword($password))) {
32
+				return 'USER_ERROR_PASSWORD_INVALID';
33
+			}
28 34
 
29 35
 			# Create user object
30 36
 
@@ -32,19 +38,27 @@  discard block
 block discarded – undo
32 38
 
33 39
 			# Init user
34 40
 
35
-			if (!$user->init($name, 'name')) return 'USER_ERROR_NAME_INCORRECT';
41
+			if (!$user->init($name, 'name')) {
42
+				return 'USER_ERROR_NAME_INCORRECT';
43
+			}
36 44
 
37
-			if (Auth::admin() && ($user->rank < RANK_ADMINISTRATOR)) return 'USER_ERROR_NAME_INCORRECT';
45
+			if (Auth::admin() && ($user->rank < RANK_ADMINISTRATOR)) {
46
+				return '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 'USER_ERROR_PASSWORD_INCORRECT';
53
+			if (0 !== strcmp($user->password, $password)) {
54
+				return '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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Auth/Auth.php 1 patch
Braces   +36 added lines, -12 removed lines patch added patch discarded remove patch
@@ -12,9 +12,13 @@  discard block
 block discarded – undo
12 12
 
13 13
 		private static function getAuth(string $code, string $type, int $lifetime) {
14 14
 
15
-			if (!($auth = Entitizer::get($type))->init($code, 'code')) return false;
15
+			if (!($auth = Entitizer::get($type))->init($code, 'code')) {
16
+				return false;
17
+			}
16 18
 
17
-			if (($auth->ip !== REQUEST_CLIENT_IP) || ($auth->time < (REQUEST_TIME - $lifetime))) return false;
19
+			if (($auth->ip !== REQUEST_CLIENT_IP) || ($auth->time < (REQUEST_TIME - $lifetime))) {
20
+				return false;
21
+			}
18 22
 
19 23
 			# ------------------------
20 24
 
@@ -25,9 +29,13 @@  discard block
 block discarded – undo
25 29
 
26 30
 		private static function getUser(int $id) {
27 31
 
28
-			if (0 === ($user = Entitizer::get(ENTITY_TYPE_USER, $id))->id) return false;
32
+			if (0 === ($user = Entitizer::get(ENTITY_TYPE_USER, $id))->id) {
33
+				return false;
34
+			}
29 35
 
30
-			if ($user->rank < (self::$admin ? RANK_ADMINISTRATOR : RANK_USER)) return false;
36
+			if ($user->rank < (self::$admin ? RANK_ADMINISTRATOR : RANK_USER)) {
37
+				return false;
38
+			}
31 39
 
32 40
 			# ------------------------
33 41
 
@@ -42,17 +50,23 @@  discard block
 block discarded – undo
42 50
 
43 51
 			# Check session code
44 52
 
45
-			if (false === ($code = Validate::authCode(Session::get('code')))) return false;
53
+			if (false === ($code = Validate::authCode(Session::get('code')))) {
54
+				return false;
55
+			}
46 56
 
47 57
 			# Get auth
48 58
 
49 59
 			$type = ENTITY_TYPE_USER_SESSION; $lifetime = CONFIG_USER_SESSION_LIFETIME;
50 60
 
51
-			if (false === ($session = self::getAuth($code, $type, $lifetime))) return false;
61
+			if (false === ($session = self::getAuth($code, $type, $lifetime))) {
62
+				return false;
63
+			}
52 64
 
53 65
 			# Get user
54 66
 
55
-			if (false === ($user = self::getUser($session->id))) return false;
67
+			if (false === ($user = self::getUser($session->id))) {
68
+				return false;
69
+			}
56 70
 
57 71
 			# Update session
58 72
 
@@ -71,21 +85,29 @@  discard block
 block discarded – undo
71 85
 
72 86
 		public static function secret() {
73 87
 
74
-			if ((null === self::$user) || (0 !== self::$user->id)) return false;
88
+			if ((null === self::$user) || (0 !== self::$user->id)) {
89
+				return false;
90
+			}
75 91
 
76 92
 			# Check secret code
77 93
 
78
-			if (false === ($code = Validate::authCode(Request::get('code')))) return false;
94
+			if (false === ($code = Validate::authCode(Request::get('code')))) {
95
+				return false;
96
+			}
79 97
 
80 98
 			# Get auth
81 99
 
82 100
 			$type = ENTITY_TYPE_USER_SECRET; $lifetime = CONFIG_USER_SECRET_LIFETIME;
83 101
 
84
-			if (false === ($secret = self::getAuth($code, $type, $lifetime))) return false;
102
+			if (false === ($secret = self::getAuth($code, $type, $lifetime))) {
103
+				return false;
104
+			}
85 105
 
86 106
 			# Get user
87 107
 
88
-			if (false === ($user = self::getUser($secret->id))) return false;
108
+			if (false === ($user = self::getUser($secret->id))) {
109
+				return false;
110
+			}
89 111
 
90 112
 			# ------------------------
91 113
 
@@ -96,7 +118,9 @@  discard block
 block discarded – undo
96 118
 
97 119
 		public static function logout() {
98 120
 
99
-			if ((null === self::$user) || (0 === self::$user->id)) return false;
121
+			if ((null === self::$user) || (0 === self::$user->id)) {
122
+				return false;
123
+			}
100 124
 
101 125
 			# Remove session
102 126
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Utils/Validate.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,9 +49,13 @@
 block discarded – undo
49 49
 
50 50
 		public static function url(string $value) {
51 51
 
52
-			if (false === ($value = parent::url($value))) return false;
52
+			if (false === ($value = parent::url($value))) {
53
+				return false;
54
+			}
53 55
 
54
-			if (!preg_match('/^https?:\/\//', $value)) return false;
56
+			if (!preg_match('/^https?:\/\//', $value)) {
57
+				return false;
58
+			}
55 59
 
56 60
 			# ------------------------
57 61
 
Please login to merge, or discard this patch.
www/engine/System/Includes/Regex.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -2,15 +2,15 @@
 block discarded – undo
2 2
 
3 3
 # Regular expressions
4 4
 
5
-define('REGEX_MAP_ITEM_PATH',                       '/^[a-zA-Z0-9_\-\+\.\,\'\*\(\)\[\]:;!$%~]+$/');
6
-define('REGEX_MAP_ITEM_HANDLER',                    '/^[A-Z][a-zA-Z0-9]*$/');
5
+define('REGEX_MAP_ITEM_PATH', '/^[a-zA-Z0-9_\-\+\.\,\'\*\(\)\[\]:;!$%~]+$/');
6
+define('REGEX_MAP_ITEM_HANDLER', '/^[A-Z][a-zA-Z0-9]*$/');
7 7
 
8
-define('REGEX_LANGUAGE_NAME',                       '/^[a-z][a-z]-[A-Z][A-Z]$/');
9
-define('REGEX_TEMPLATE_NAME',                       '/^[A-Z0-9][a-zA-Z0-9]*$/');
8
+define('REGEX_LANGUAGE_NAME', '/^[a-z][a-z]-[A-Z][A-Z]$/');
9
+define('REGEX_TEMPLATE_NAME', '/^[A-Z0-9][a-zA-Z0-9]*$/');
10 10
 
11
-define('REGEX_USER_AUTH_CODE',                      '/^[a-zA-Z0-9]{40}$/');
11
+define('REGEX_USER_AUTH_CODE', '/^[a-zA-Z0-9]{40}$/');
12 12
 
13
-define('REGEX_USER_NAME',                           '/^(?!_)(?!.*_$)(?!.*_{2,})[a-zA-Z0-9_]+$/');
14
-define('REGEX_USER_PASSWORD',                       '/^.+$/');
13
+define('REGEX_USER_NAME', '/^(?!_)(?!.*_$)(?!.*_{2,})[a-zA-Z0-9_]+$/');
14
+define('REGEX_USER_PASSWORD', '/^.+$/');
15 15
 
16
-define('REGEX_FILE_NAME',                           '/^[^\/?%*:|"<>\\\]+$/');
16
+define('REGEX_FILE_NAME', '/^[^\/?%*:|"<>\\\]+$/');
Please login to merge, or discard this patch.
www/engine/System/Includes/Constants.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -2,78 +2,78 @@
 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.2.2');
9
-define('CADMIUM_COPY',                              '2016');
8
+define('CADMIUM_VERSION', '0.2.2');
9
+define('CADMIUM_COPY', '2016');
10 10
 
11 11
 # External
12 12
 
13
-define('JQUERY_VERSION',                            '2.2.0');
14
-define('SEMANTIC_UI_VERSION',                       '2.1.8');
15
-define('CKEDITOR_VERSION',                          '4.5.6');
13
+define('JQUERY_VERSION', '2.2.0');
14
+define('SEMANTIC_UI_VERSION', '2.1.8');
15
+define('CKEDITOR_VERSION', '4.5.6');
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
 # Entity types
23 23
 
24
-define('ENTITY_TYPE_PAGE',                          'page');
25
-define('ENTITY_TYPE_MENUITEM',                      'menuitem');
26
-define('ENTITY_TYPE_VARIABLE',                      'variable');
27
-define('ENTITY_TYPE_WIDGET',                        'widget');
28
-define('ENTITY_TYPE_USER',                          'user');
29
-define('ENTITY_TYPE_USER_SECRET',                   'user_secret');
30
-define('ENTITY_TYPE_USER_SESSION',                  'user_session');
24
+define('ENTITY_TYPE_PAGE', 'page');
25
+define('ENTITY_TYPE_MENUITEM', 'menuitem');
26
+define('ENTITY_TYPE_VARIABLE', 'variable');
27
+define('ENTITY_TYPE_WIDGET', 'widget');
28
+define('ENTITY_TYPE_USER', 'user');
29
+define('ENTITY_TYPE_USER_SECRET', 'user_secret');
30
+define('ENTITY_TYPE_USER_SESSION', 'user_session');
31 31
 
32 32
 # Filemanager types
33 33
 
34
-define('FILEMANAGER_TYPE_DIR',                      'dir');
35
-define('FILEMANAGER_TYPE_FILE',                     'file');
34
+define('FILEMANAGER_TYPE_DIR', 'dir');
35
+define('FILEMANAGER_TYPE_FILE', 'file');
36 36
 
37 37
 # Access
38 38
 
39
-define('ACCESS_PUBLIC',                             0);
40
-define('ACCESS_REGISTERED',                         1);
41
-define('ACCESS_ADMINISTRATOR',                      2);
39
+define('ACCESS_PUBLIC', 0);
40
+define('ACCESS_REGISTERED', 1);
41
+define('ACCESS_ADMINISTRATOR', 2);
42 42
 
43 43
 # Frequency
44 44
 
45
-define('FREQUENCY_ALWAYS',                          'always');
46
-define('FREQUENCY_HOURLY',                          'hourly');
47
-define('FREQUENCY_DAILY',                           'daily');
48
-define('FREQUENCY_WEEKLY',                          'weekly');
49
-define('FREQUENCY_MONTHLY',                         'monthly');
50
-define('FREQUENCY_YEARLY',                          'yearly');
51
-define('FREQUENCY_NEVER',                           'never');
45
+define('FREQUENCY_ALWAYS', 'always');
46
+define('FREQUENCY_HOURLY', 'hourly');
47
+define('FREQUENCY_DAILY', 'daily');
48
+define('FREQUENCY_WEEKLY', 'weekly');
49
+define('FREQUENCY_MONTHLY', 'monthly');
50
+define('FREQUENCY_YEARLY', 'yearly');
51
+define('FREQUENCY_NEVER', 'never');
52 52
 
53 53
 # Rank
54 54
 
55
-define('RANK_GUEST',                                0);
56
-define('RANK_USER',                                 1);
57
-define('RANK_ADMINISTRATOR',                        2);
55
+define('RANK_GUEST', 0);
56
+define('RANK_USER', 1);
57
+define('RANK_ADMINISTRATOR', 2);
58 58
 
59 59
 # Sex
60 60
 
61
-define('SEX_NOT_SELECTED',                          0);
62
-define('SEX_MALE',                                  1);
63
-define('SEX_FEMALE',                                2);
61
+define('SEX_NOT_SELECTED', 0);
62
+define('SEX_MALE', 1);
63
+define('SEX_FEMALE', 2);
64 64
 
65 65
 # Status
66 66
 
67
-define('STATUS_ONLINE',                             0);
68
-define('STATUS_MAINTENANCE',                        1);
69
-define('STATUS_UPDATE',                             2);
67
+define('STATUS_ONLINE', 0);
68
+define('STATUS_MAINTENANCE', 1);
69
+define('STATUS_UPDATE', 2);
70 70
 
71 71
 # Target
72 72
 
73
-define('TARGET_SELF',                               0);
74
-define('TARGET_BLANK',                              1);
73
+define('TARGET_SELF', 0);
74
+define('TARGET_BLANK', 1);
75 75
 
76 76
 # Visibility
77 77
 
78
-define('VISIBILITY_DRAFT',                          0);
79
-define('VISIBILITY_PUBLISHED',                      1);
78
+define('VISIBILITY_DRAFT', 0);
79
+define('VISIBILITY_PUBLISHED', 1);
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Extend/Utils/Extension.php 2 patches
Braces   +43 added lines, -15 removed lines patch added patch discarded remove patch
@@ -32,11 +32,15 @@  discard block
 block discarded – undo
32 32
 
33 33
 				$file_name = ($dir_name . $name . '/Config.json');
34 34
 
35
-				if (false === ($config = Explorer::json($file_name))) continue;
35
+				if (false === ($config = Explorer::json($file_name))) {
36
+					continue;
37
+				}
36 38
 
37 39
 				$config = Arr::select($config, self::$data);
38 40
 
39
-				if (!(self::valid($config['name']) && ($config['name'] === $name))) continue;
41
+				if (!(self::valid($config['name']) && ($config['name'] === $name))) {
42
+					continue;
43
+				}
40 44
 
41 45
 				$items[$name] = array_map('strval', $config);
42 46
 			}
@@ -52,11 +56,19 @@  discard block
 block discarded – undo
52 56
 
53 57
 			$name = ''; $param = self::$param[self::$section];
54 58
 
55
-			if (self::exists($name_cookie = Cookie::get($param))) $name = $name_cookie;
59
+			if (self::exists($name_cookie = Cookie::get($param))) {
60
+				$name = $name_cookie;
61
+			}
56 62
 
57
-			if (self::exists($name_get = Request::get(self::$name))) $name = $name_get;
63
+			if (self::exists($name_get = Request::get(self::$name))) {
64
+				$name = $name_get;
65
+			}
58 66
 
59
-			if ('' !== $name) Cookie::set($param, $name, self::$cookie_expires); else return false;
67
+			if ('' !== $name) {
68
+				Cookie::set($param, $name, self::$cookie_expires);
69
+			} else {
70
+				return false;
71
+			}
60 72
 
61 73
 			# ------------------------
62 74
 
@@ -90,7 +102,9 @@  discard block
 block discarded – undo
90 102
 
91 103
 			$section = self::getSection($section); $dir_name = self::getDirName($section);
92 104
 
93
-			if (!Explorer::isDir($dir_name)) throw new Exception\General(self::$error_directory);
105
+			if (!Explorer::isDir($dir_name)) {
106
+				throw new Exception\General(self::$error_directory);
107
+			}
94 108
 
95 109
 			self::$section = $section; self::$dir_name = $dir_name; self::$items = self::getItems($dir_name);
96 110
 
@@ -98,11 +112,15 @@  discard block
 block discarded – undo
98 112
 
99 113
 			$primary = (self::exists(self::$default[$section]) ? self::$default[$section] : false);
100 114
 
101
-			if ($selectable && (false !== ($name = self::getUserDefined()))) $name_valid = true;
102
-
103
-			else $name_valid = (self::exists($name = Settings::get($param)) || (false !== ($name = $primary)));
115
+			if ($selectable && (false !== ($name = self::getUserDefined()))) {
116
+				$name_valid = true;
117
+			} else {
118
+				$name_valid = (self::exists($name = Settings::get($param)) || (false !== ($name = $primary)));
119
+			}
104 120
 
105
-			if (!($name_valid || (null !== ($name = key(self::$items))))) throw new Exception\General(self::$error_select);
121
+			if (!($name_valid || (null !== ($name = key(self::$items))))) {
122
+				throw new Exception\General(self::$error_select);
123
+			}
106 124
 
107 125
 			# ------------------------
108 126
 
@@ -127,7 +145,9 @@  discard block
 block discarded – undo
127 145
 
128 146
 		public static function items(string $section = null) {
129 147
 
130
-			if (null === $section) return self::$items;
148
+			if (null === $section) {
149
+				return self::$items;
150
+			}
131 151
 
132 152
 			$section = self::getSection($section); $dir_name = self::getDirName($section);
133 153
 
@@ -152,7 +172,9 @@  discard block
 block discarded – undo
152 172
 
153 173
 		public static function path() {
154 174
 
155
-			if ('' === self::$active) return false;
175
+			if ('' === self::$active) {
176
+				return false;
177
+			}
156 178
 
157 179
 			return (self::$dir_name . self::$active . '/');
158 180
 		}
@@ -161,7 +183,9 @@  discard block
 block discarded – undo
161 183
 
162 184
 		public static function pathPrimary() {
163 185
 
164
-			if ('' === self::$primary) return false;
186
+			if ('' === self::$primary) {
187
+				return false;
188
+			}
165 189
 
166 190
 			return (self::$dir_name . self::$primary . '/');
167 191
 		}
@@ -170,9 +194,13 @@  discard block
 block discarded – undo
170 194
 
171 195
 		public static function data(string $name = null) {
172 196
 
173
-			if ('' === self::$active) return false;
197
+			if ('' === self::$active) {
198
+				return false;
199
+			}
174 200
 
175
-			if (null === $name) return self::$items[self::$active];
201
+			if (null === $name) {
202
+				return self::$items[self::$active];
203
+			}
176 204
 
177 205
 			return (isset(self::$items[self::$active][$name]) ? self::$items[self::$active][$name] : false);
178 206
 		}
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
 		private static function getDirName(string $section) {
21 21
 
22
-			return (self::$root_dir . (self::$separate ? ($section . '/') : ''));
22
+			return (self::$root_dir.(self::$separate ? ($section.'/') : ''));
23 23
 		}
24 24
 
25 25
 		# Get items
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 			foreach (Explorer::listDirs($dir_name) as $name) {
32 32
 
33
-				$file_name = ($dir_name . $name . '/Config.json');
33
+				$file_name = ($dir_name.$name.'/Config.json');
34 34
 
35 35
 				if (false === ($config = Explorer::json($file_name))) continue;
36 36
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 
155 155
 			if ('' === self::$active) return false;
156 156
 
157
-			return (self::$dir_name . self::$active . '/');
157
+			return (self::$dir_name.self::$active.'/');
158 158
 		}
159 159
 
160 160
 		# Get primary extension path
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 
164 164
 			if ('' === self::$primary) return false;
165 165
 
166
-			return (self::$dir_name . self::$primary . '/');
166
+			return (self::$dir_name.self::$primary.'/');
167 167
 		}
168 168
 
169 169
 		# Get active extension data
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Settings/Settings.php 2 patches
Braces   +39 added lines, -13 removed lines patch added patch discarded remove patch
@@ -37,7 +37,9 @@  discard block
 block discarded – undo
37 37
 
38 38
 		public static function __autoload() {
39 39
 
40
-			if (self::$loaded || empty($host = getenv('HTTP_HOST'))) return;
40
+			if (self::$loaded || empty($host = getenv('HTTP_HOST'))) {
41
+				return;
42
+			}
41 43
 
42 44
 			self::$settings['system_url'] = ((Request::isSecure() ? 'https://' : 'http://') . $host);
43 45
 
@@ -52,7 +54,9 @@  discard block
 block discarded – undo
52 54
 
53 55
 			self::$loaded = (false !== ($settings = Explorer::json($settings_file)));
54 56
 
55
-			if (self::$loaded) foreach ($settings as $name => $value) self::set($name, $value);
57
+			if (self::$loaded) {
58
+				foreach ($settings as $name => $value) self::set($name, $value);
59
+			}
56 60
 
57 61
 			# ------------------------
58 62
 
@@ -65,9 +69,13 @@  discard block
 block discarded – undo
65 69
 
66 70
 			$settings_file = (DIR_SYSTEM_DATA . 'Settings.json');
67 71
 
68
-			if (false === ($settings = json_encode(self::$settings, JSON_PRETTY_PRINT))) return false;
72
+			if (false === ($settings = json_encode(self::$settings, JSON_PRETTY_PRINT))) {
73
+				return false;
74
+			}
69 75
 
70
-			if (false === Explorer::save($settings_file, $settings, true)) return false;
76
+			if (false === Explorer::save($settings_file, $settings, true)) {
77
+				return false;
78
+			}
71 79
 
72 80
 			# ------------------------
73 81
 
@@ -85,34 +93,44 @@  discard block
 block discarded – undo
85 93
 
86 94
 		public static function set(string $name, $value) {
87 95
 
88
-			if (!isset(self::$settings[$name]) || !is_scalar($value)) return false;
96
+			if (!isset(self::$settings[$name]) || !is_scalar($value)) {
97
+				return false;
98
+			}
89 99
 
90 100
 			# Validate language
91 101
 
92 102
 			if (($name === 'admin_language') || ($name === 'site_language')) {
93 103
 
94
-				if (false === ($value = Extend\Languages::validate($value))) return false;
104
+				if (false === ($value = Extend\Languages::validate($value))) {
105
+					return false;
106
+				}
95 107
 			}
96 108
 
97 109
 			# Validate template
98 110
 
99 111
 			else if (($name === 'admin_template') || ($name === 'site_template')) {
100 112
 
101
-				if (false === ($value = Extend\Templates::validate($value))) return false;
113
+				if (false === ($value = Extend\Templates::validate($value))) {
114
+					return false;
115
+				}
102 116
 			}
103 117
 
104 118
 			# Validate site title
105 119
 
106 120
 			else if ($name === 'site_title') {
107 121
 
108
-				if ('' === ($value = strval($value))) return false;
122
+				if ('' === ($value = strval($value))) {
123
+					return false;
124
+				}
109 125
 			}
110 126
 
111 127
 			# Validate site status
112 128
 
113 129
 			else if ($name === 'site_status') {
114 130
 
115
-				if (false === ($value = Lister\Status::validate($value))) return false;
131
+				if (false === ($value = Lister\Status::validate($value))) {
132
+					return false;
133
+				}
116 134
 			}
117 135
 
118 136
 			# Validate site slogan/description/keywords
@@ -126,21 +144,27 @@  discard block
 block discarded – undo
126 144
 
127 145
 			else if ($name === 'system_url') {
128 146
 
129
-				if (false === ($value = Validate::url($value))) return false;
147
+				if (false === ($value = Validate::url($value))) {
148
+					return false;
149
+				}
130 150
 			}
131 151
 
132 152
 			# Validate system email
133 153
 
134 154
 			else if ($name === 'system_email') {
135 155
 
136
-				if (false === ($value = Validate::email($value))) return false;
156
+				if (false === ($value = Validate::email($value))) {
157
+					return false;
158
+				}
137 159
 			}
138 160
 
139 161
 			# Validate system timezone
140 162
 
141 163
 			else if ($name === 'system_timezone') {
142 164
 
143
-				if (false === ($value = Timezone::validate($value))) return false;
165
+				if (false === ($value = Timezone::validate($value))) {
166
+					return false;
167
+				}
144 168
 			}
145 169
 
146 170
 			# Validate users registration
@@ -163,7 +187,9 @@  discard block
 block discarded – undo
163 187
 
164 188
 		public static function get(string $name = null) {
165 189
 
166
-			if (null === $name) return self::$settings;
190
+			if (null === $name) {
191
+				return self::$settings;
192
+			}
167 193
 
168 194
 			return (isset(self::$settings[$name]) ? self::$settings[$name] : null);
169 195
 		}
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,16 +39,16 @@  discard block
 block discarded – undo
39 39
 
40 40
 			if (self::$loaded || empty($host = getenv('HTTP_HOST'))) return;
41 41
 
42
-			self::$settings['system_url'] = ((Request::isSecure() ? 'https://' : 'http://') . $host);
42
+			self::$settings['system_url'] = ((Request::isSecure() ? 'https://' : 'http://').$host);
43 43
 
44
-			self::$settings['system_email'] = ('admin@' . $host);
44
+			self::$settings['system_email'] = ('admin@'.$host);
45 45
 		}
46 46
 
47 47
 		# Init settings
48 48
 
49 49
 		public static function init() {
50 50
 
51
-			$settings_file = (DIR_SYSTEM_DATA . 'Settings.json');
51
+			$settings_file = (DIR_SYSTEM_DATA.'Settings.json');
52 52
 
53 53
 			self::$loaded = (false !== ($settings = Explorer::json($settings_file)));
54 54
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
 		public static function save() {
65 65
 
66
-			$settings_file = (DIR_SYSTEM_DATA . 'Settings.json');
66
+			$settings_file = (DIR_SYSTEM_DATA.'Settings.json');
67 67
 
68 68
 			if (false === ($settings = json_encode(self::$settings, JSON_PRETTY_PRINT))) return false;
69 69
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Utils/Map.php 2 patches
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,7 +14,9 @@  discard block
 block discarded – undo
14 14
 
15 15
 			$parts = preg_split('/\//', $string, 0, PREG_SPLIT_NO_EMPTY);
16 16
 
17
-			foreach ($parts as $name) if (!preg_match($regex, $name)) return false;
17
+			foreach ($parts as $name) {
18
+				if (!preg_match($regex, $name)) return false;
19
+			}
18 20
 
19 21
 			# ------------------------
20 22
 
@@ -27,9 +29,13 @@  discard block
 block discarded – undo
27 29
 
28 30
 			$data = Arr::select($item, ['path', 'handler']);
29 31
 
30
-			if (false === ($path = $this->parseString($data['path'], REGEX_MAP_ITEM_PATH))) return;
32
+			if (false === ($path = $this->parseString($data['path'], REGEX_MAP_ITEM_PATH))) {
33
+				return;
34
+			}
31 35
 
32
-			if (false === ($handler = $this->parseString($data['handler'], REGEX_MAP_ITEM_HANDLER))) return;
36
+			if (false === ($handler = $this->parseString($data['handler'], REGEX_MAP_ITEM_HANDLER))) {
37
+				return;
38
+			}
33 39
 
34 40
 			$this->map[] = ['path' => $path, 'handler' => implode('\\', $handler)];
35 41
 		}
@@ -40,16 +46,22 @@  discard block
 block discarded – undo
40 46
 
41 47
 			$file_name = (DIR_SYSTEM_DATA . 'Map.json');
42 48
 
43
-			if (false === ($map = Explorer::json($file_name))) return;
49
+			if (false === ($map = Explorer::json($file_name))) {
50
+				return;
51
+			}
44 52
 
45
-			foreach ($map as $item) if (is_array($item)) $this->parseItem($item);
53
+			foreach ($map as $item) {
54
+				if (is_array($item)) $this->parseItem($item);
55
+			}
46 56
 		}
47 57
 
48 58
 		# Get handler by url
49 59
 
50 60
 		public function handler(Url $url) {
51 61
 
52
-			foreach ($this->map as $item) if ($item['path'] === $url->path()) return $item['handler'];
62
+			foreach ($this->map as $item) {
63
+				if ($item['path'] === $url->path()) return $item['handler'];
64
+			}
53 65
 
54 66
 			return false;
55 67
 		}
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
 
39 39
 		public function __construct() {
40 40
 
41
-			$file_name = (DIR_SYSTEM_DATA . 'Map.json');
41
+			$file_name = (DIR_SYSTEM_DATA.'Map.json');
42 42
 
43 43
 			if (false === ($map = Explorer::json($file_name))) return;
44 44
 
Please login to merge, or discard this patch.