Completed
Push — master ( 8e013f...5c10bd )
by Anton
03:39
created
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.
www/engine/System/Classes/Modules/Filemanager/Utils/Entity.php 1 patch
Braces   +36 added lines, -12 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
12 12
 
13 13
 		private function getPrototype(string $name) {
14 14
 
15
-			if (preg_match('/[\/\\\\]/', $name)) return false;
15
+			if (preg_match('/[\/\\\\]/', $name)) {
16
+				return false;
17
+			}
16 18
 
17 19
 			$path = (($this->parent->path() ? ($this->parent->path() . '/') : '') . $name);
18 20
 
@@ -34,11 +36,17 @@  discard block
 block discarded – undo
34 36
 
35 37
 		public function init(string $name) {
36 38
 
37
-			if (false === ($prototype = $this->getPrototype($name))) return false;
39
+			if (false === ($prototype = $this->getPrototype($name))) {
40
+				return false;
41
+			}
38 42
 
39
-			if (!Explorer::{static::$checker}($prototype['path_full'])) return false;
43
+			if (!Explorer::{static::$checker}($prototype['path_full'])) {
44
+				return false;
45
+			}
40 46
 
41
-			foreach ($prototype as $var => $value) $this->$var = $value;
47
+			foreach ($prototype as $var => $value) {
48
+				$this->$var = $value;
49
+			}
42 50
 
43 51
 			# ------------------------
44 52
 
@@ -49,11 +57,17 @@  discard block
 block discarded – undo
49 57
 
50 58
 		public function create(string $name) {
51 59
 
52
-			if (('' !== $this->name) || (false === ($prototype = $this->getPrototype($name)))) return false;
60
+			if (('' !== $this->name) || (false === ($prototype = $this->getPrototype($name)))) {
61
+				return false;
62
+			}
53 63
 
54
-			if (!Explorer::{static::$creator}($prototype['path_full'])) return false;
64
+			if (!Explorer::{static::$creator}($prototype['path_full'])) {
65
+				return false;
66
+			}
55 67
 
56
-			foreach ($prototype as $var => $value) $this->$var = $value;
68
+			foreach ($prototype as $var => $value) {
69
+				$this->$var = $value;
70
+			}
57 71
 
58 72
 			# ------------------------
59 73
 
@@ -64,11 +78,17 @@  discard block
 block discarded – undo
64 78
 
65 79
 		public function rename(string $name) {
66 80
 
67
-			if (('' === $this->name) || (false === ($prototype = $this->getPrototype($name)))) return false;
81
+			if (('' === $this->name) || (false === ($prototype = $this->getPrototype($name)))) {
82
+				return false;
83
+			}
68 84
 
69
-			if (!@rename($this->path_full, $prototype['path_full'])) return false;
85
+			if (!@rename($this->path_full, $prototype['path_full'])) {
86
+				return false;
87
+			}
70 88
 
71
-			foreach ($prototype as $var => $value) $this->$var = $value;
89
+			foreach ($prototype as $var => $value) {
90
+				$this->$var = $value;
91
+			}
72 92
 
73 93
 			# ------------------------
74 94
 
@@ -79,9 +99,13 @@  discard block
 block discarded – undo
79 99
 
80 100
 		public function remove() {
81 101
 
82
-			if ('' === $this->name) return false;
102
+			if ('' === $this->name) {
103
+				return false;
104
+			}
83 105
 
84
-			if (!Explorer::{static::$remover}($this->path_full, true)) return false;
106
+			if (!Explorer::{static::$remover}($this->path_full, true)) {
107
+				return false;
108
+			}
85 109
 
86 110
 			$this->name = ''; $this->path = ''; $this->path_full = '';
87 111
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Filemanager/Utils/Mime.php 1 patch
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,19 +12,33 @@
 block discarded – undo
12 12
 
13 13
 			$extension = strtolower(Explorer::extension($file_name, false));
14 14
 
15
-			if (self::isImage($extension)) return 'image';
15
+			if (self::isImage($extension)) {
16
+				return 'image';
17
+			}
16 18
 
17
-			if (self::isAudio($extension)) return 'audio';
19
+			if (self::isAudio($extension)) {
20
+				return 'audio';
21
+			}
18 22
 
19
-			if (self::isVideo($extension)) return 'video';
23
+			if (self::isVideo($extension)) {
24
+				return 'video';
25
+			}
20 26
 
21
-			if (in_array($extension, ['doc', 'docx'], true)) return 'word';
27
+			if (in_array($extension, ['doc', 'docx'], true)) {
28
+				return 'word';
29
+			}
22 30
 
23
-			if (in_array($extension, ['xls', 'xlsx'], true)) return 'excel';
31
+			if (in_array($extension, ['xls', 'xlsx'], true)) {
32
+				return 'excel';
33
+			}
24 34
 
25
-			if (in_array($extension, ['ppt', 'pptx'], true)) return 'powerpoint';
35
+			if (in_array($extension, ['ppt', 'pptx'], true)) {
36
+				return 'powerpoint';
37
+			}
26 38
 
27
-			if ($extension === 'pdf') return 'pdf';
39
+			if ($extension === 'pdf') {
40
+				return 'pdf';
41
+			}
28 42
 
29 43
 			# ------------------------
30 44
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Filemanager/Utils/Handler.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -49,7 +49,9 @@  discard block
 block discarded – undo
49 49
 
50 50
 			if (Request::post('action') === 'remove') {
51 51
 
52
-				if (!$this->entity->remove()) return $ajax->error(Language::get(static::$message_error_remove));
52
+				if (!$this->entity->remove()) {
53
+					return $ajax->error(Language::get(static::$message_error_remove));
54
+				}
53 55
 			}
54 56
 
55 57
 			# ------------------------
@@ -80,7 +82,9 @@  discard block
 block discarded – undo
80 82
 
81 83
 			# Handle ajax request
82 84
 
83
-			if (Request::isAjax()) return $this->handleAjax();
85
+			if (Request::isAjax()) {
86
+				return $this->handleAjax();
87
+			}
84 88
 
85 89
 			# Create form
86 90
 
@@ -97,7 +101,9 @@  discard block
 block discarded – undo
97 101
 
98 102
 			# Display success message
99 103
 
100
-			if (false !== Request::get('submitted')) Messages::success(Language::get(static::$message_success_rename));
104
+			if (false !== Request::get('submitted')) {
105
+				Messages::success(Language::get(static::$message_success_rename));
106
+			}
101 107
 
102 108
 			# ------------------------
103 109
 
Please login to merge, or discard this patch.