Completed
Branch master (8e013f)
by Anton
03:58
created
www/engine/System/Classes/Modules/Auth/Controller/Recover.php 1 patch
Braces   +12 added lines, -4 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 false;
13
+			if (!Auth::check()) {
14
+				return false;
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 === ($password_new = Auth\Validate::userPassword($password_new))) return 'USER_ERROR_PASSWORD_NEW_INVALID';
27
+			if (false === ($password_new = Auth\Validate::userPassword($password_new))) {
28
+				return 'USER_ERROR_PASSWORD_NEW_INVALID';
29
+			}
26 30
 
27
-			if (0 !== strcmp($password_new, $password_retype)) return 'USER_ERROR_PASSWORD_MISMATCH';
31
+			if (0 !== strcmp($password_new, $password_retype)) {
32
+				return 'USER_ERROR_PASSWORD_MISMATCH';
33
+			}
28 34
 
29 35
 			# Encode password
30 36
 
@@ -34,7 +40,9 @@  discard block
 block discarded – undo
34 40
 
35 41
 			$data = ['auth_key' => $auth_key, 'password' => $password];
36 42
 
37
-			if (!Auth::user()->edit($data)) return 'USER_ERROR_AUTH_RECOVER';
43
+			if (!Auth::user()->edit($data)) {
44
+				return 'USER_ERROR_AUTH_RECOVER';
45
+			}
38 46
 
39 47
 			# Remove secret
40 48
 
Please login to merge, or discard this patch.
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 = Auth\Validate::userName($name))) return 'USER_ERROR_NAME_INVALID';
27
+			if (false === ($name = Auth\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/Handler/Recover.php 1 patch
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,9 +14,11 @@
 block discarded – undo
14 14
 
15 15
 			# Init user by secret code
16 16
 
17
-			if (false !== ($code = Auth::secret())) $this->code = $code;
18
-
19
-			else Request::redirect(INSTALL_PATH . (Auth::admin() ? '/admin' : '/profile') . '/reset');
17
+			if (false !== ($code = Auth::secret())) {
18
+				$this->code = $code;
19
+			} else {
20
+				Request::redirect(INSTALL_PATH . (Auth::admin() ? '/admin' : '/profile') . '/reset');
21
+			}
20 22
 
21 23
 			# Create form
22 24
 
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 = Auth\Validate::code(Session::get('code')))) return false;
53
+			if (false === ($code = Auth\Validate::code(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 = Auth\Validate::code(Request::get('code')))) return false;
94
+			if (false === ($code = Auth\Validate::code(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/Modules/Auth/Validate.php 1 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
 		private static function validate(string $string, string $regex, int $min, int $max) {
12 12
 
13
-			if (!preg_match($regex, $string)) return false;
13
+			if (!preg_match($regex, $string)) {
14
+				return false;
15
+			}
14 16
 
15 17
 			return ((Str::between($string, $min, $max)) ? $string : false);
16 18
 		}
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Auth/Utils/Handler.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,9 @@
 block discarded – undo
20 20
 
21 21
 			# Implement form
22 22
 
23
-			if (null !== $this->form) $this->form->implement($contents);
23
+			if (null !== $this->form) {
24
+				$this->form->implement($contents);
25
+			}
24 26
 
25 27
 			# ------------------------
26 28
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Filemanager/Controller/Create.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,19 +29,25 @@
 block discarded – undo
29 29
 
30 30
 			# Validate name
31 31
 
32
-			if (false === ($name = Filemanager\Validate::name($name))) return 'FILEMANAGER_ERROR_NAME_INVALID';
32
+			if (false === ($name = Filemanager\Validate::name($name))) {
33
+				return 'FILEMANAGER_ERROR_NAME_INVALID';
34
+			}
33 35
 
34 36
 			# Check if item exists
35 37
 
36
-			if (@file_exists($this->parent->pathFull() . $name)) return 'FILEMANAGER_ERROR_EXISTS';
38
+			if (@file_exists($this->parent->pathFull() . $name)) {
39
+				return 'FILEMANAGER_ERROR_EXISTS';
40
+			}
37 41
 
38 42
 			# Create item
39 43
 
40 44
 			$entity = Filemanager::get($type, $this->parent);
41 45
 
42
-			if (!$entity->create($name)) return (($entity->type() === FILEMANAGER_TYPE_DIR) ?
46
+			if (!$entity->create($name)) {
47
+				return (($entity->type() === FILEMANAGER_TYPE_DIR) ?
43 48
 
44 49
 				'FILEMANAGER_ERROR_DIR_CREATE' : 'FILEMANAGER_ERROR_FILE_CREATE');
50
+			}
45 51
 
46 52
 			# ------------------------
47 53
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Filemanager/Controller/Rename.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,19 +29,25 @@
 block discarded – undo
29 29
 
30 30
 			# Validate name
31 31
 
32
-			if (false === ($name = Filemanager\Validate::name($name))) return 'FILEMANAGER_ERROR_NAME_INVALID';
32
+			if (false === ($name = Filemanager\Validate::name($name))) {
33
+				return 'FILEMANAGER_ERROR_NAME_INVALID';
34
+			}
33 35
 
34 36
 			# Check if item exists
35 37
 
36 38
 			if ((0 !== strcasecmp($this->entity->name(), $name)) &&
37 39
 
38
-				@file_exists($this->entity->parent()->pathFull() . $name)) return 'FILEMANAGER_ERROR_EXISTS';
40
+				@file_exists($this->entity->parent()->pathFull() . $name)) {
41
+				return 'FILEMANAGER_ERROR_EXISTS';
42
+			}
39 43
 
40 44
 			# Rename item
41 45
 
42
-			if (!$this->entity->rename($name)) return (($this->entity->type() === FILEMANAGER_TYPE_DIR) ?
46
+			if (!$this->entity->rename($name)) {
47
+				return (($this->entity->type() === FILEMANAGER_TYPE_DIR) ?
43 48
 
44 49
 				'FILEMANAGER_ERROR_DIR_RENAME' : 'FILEMANAGER_ERROR_FILE_RENAME');
50
+			}
45 51
 
46 52
 			# ------------------------
47 53
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Filemanager/Utils/Container.php 1 patch
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@  discard block
 block discarded – undo
16 16
 
17 17
 			$path = implode('/', $scheme); $path_full = (DIR_UPLOADS . (('' !== $path) ? ($path . '/') : ''));
18 18
 
19
-			if (!Explorer::isDir($path_full)) return;
19
+			if (!Explorer::isDir($path_full)) {
20
+				return;
21
+			}
20 22
 
21 23
 			$this->scheme = $scheme; $this->path = $path; $this->path_full = $path_full;
22 24
 		}
@@ -27,9 +29,12 @@  discard block
 block discarded – undo
27 29
 
28 30
 			$scheme = []; $breadcrumbs = [];
29 31
 
30
-			if ([] !== $this->scheme) foreach ($this->scheme as $name) {
32
+			if ([] !== $this->scheme) {
33
+				foreach ($this->scheme as $name) {
31 34
 
32
-				$scheme[] = $name; $breadcrumbs[] = ['path' => implode('/', $scheme), 'name' => $name];
35
+				$scheme[] = $name;
36
+			}
37
+			$breadcrumbs[] = ['path' => implode('/', $scheme), 'name' => $name];
33 38
 			}
34 39
 
35 40
 			# ------------------------
Please login to merge, or discard this patch.