Passed
Pull Request — master (#16)
by Anton
03:08
created
www/engine/System/Classes/Modules/Profile/Controller/Password.php 1 patch
Braces   +15 added lines, -8 removed lines patch added patch discarded remove patch
@@ -33,23 +33,28 @@  discard block
 block discarded – undo
33 33
 
34 34
 			# Validate values
35 35
 
36
-			if (false === ($password = Validate::userPassword($password)))
37
-
36
+			if (false === ($password = Validate::userPassword($password))) {
37
+			
38 38
 				return ['password', 'USER_ERROR_PASSWORD_INVALID'];
39
+			}
39 40
 
40
-			if (false === ($password_new = Validate::userPassword($password_new)))
41
-
41
+			if (false === ($password_new = Validate::userPassword($password_new))) {
42
+			
42 43
 				return ['password_new', 'USER_ERROR_PASSWORD_NEW_INVALID'];
44
+			}
43 45
 
44
-			if (0 !== strcmp($password_new, $password_retype))
45
-
46
+			if (0 !== strcmp($password_new, $password_retype)) {
47
+			
46 48
 				return ['password_retype', 'USER_ERROR_PASSWORD_MISMATCH'];
49
+			}
47 50
 
48 51
 			# Check password
49 52
 
50 53
 			$password = Str::encode(Auth::get('auth_key'), $password);
51 54
 
52
-			if (0 !== strcmp(Auth::get('password'), $password)) return ['password', 'USER_ERROR_PASSWORD_INCORRECT'];
55
+			if (0 !== strcmp(Auth::get('password'), $password)) {
56
+				return ['password', 'USER_ERROR_PASSWORD_INCORRECT'];
57
+			}
53 58
 
54 59
 			# Encode password
55 60
 
@@ -62,7 +67,9 @@  discard block
 block discarded – undo
62 67
 			$data['auth_key']           = $auth_key;
63 68
 			$data['password']           = $password;
64 69
 
65
-			if (!Auth::getUser()->edit($data)) return 'USER_ERROR_EDIT_PASSWORD';
70
+			if (!Auth::getUser()->edit($data)) {
71
+				return 'USER_ERROR_EDIT_PASSWORD';
72
+			}
66 73
 
67 74
 			# ------------------------
68 75
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Frames/Admin/Section.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
 			# Check auth
35 35
 
36
-			if (($this instanceof Area\Auth) && Auth::isLogged()) Request::redirect(INSTALL_PATH . '/admin');
36
+			if (($this instanceof Area\Auth) && Auth::isLogged()) Request::redirect(INSTALL_PATH.'/admin');
37 37
 
38 38
 			# Handle request
39 39
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 			if (!Auth::isLogged() || ((false !== Request::get('logout')) && Auth::logout())) {
56 56
 
57
-				Request::redirect(INSTALL_PATH . '/admin/login');
57
+				Request::redirect(INSTALL_PATH.'/admin/login');
58 58
 			}
59 59
 
60 60
 			# Handle request
Please login to merge, or discard this patch.
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -33,11 +33,15 @@  discard block
 block discarded – undo
33 33
 
34 34
 			# Check auth
35 35
 
36
-			if (($this instanceof Area\Auth) && Auth::isLogged()) Request::redirect(INSTALL_PATH . '/admin');
36
+			if (($this instanceof Area\Auth) && Auth::isLogged()) {
37
+				Request::redirect(INSTALL_PATH . '/admin');
38
+			}
37 39
 
38 40
 			# Handle request
39 41
 
40
-			if (Template::isBlock($result = $this->handle())) return (new View\Form($this->_title))->display($result);
42
+			if (Template::isBlock($result = $this->handle())) {
43
+				return (new View\Form($this->_title))->display($result);
44
+			}
41 45
 
42 46
 			# ------------------------
43 47
 
@@ -63,9 +67,13 @@  discard block
 block discarded – undo
63 67
 
64 68
 			$result = $this->handle(Request::isAjax() && ($request === 'display'));
65 69
 
66
-			if (Template::isBlock($result)) return (new View\Panel($this->_title))->$request($result);
70
+			if (Template::isBlock($result)) {
71
+				return (new View\Panel($this->_title))->$request($result);
72
+			}
67 73
 
68
-			if (Ajax::isResponse($result)) return Ajax::output($result);
74
+			if (Ajax::isResponse($result)) {
75
+				return Ajax::output($result);
76
+			}
69 77
 
70 78
 			# ------------------------
71 79
 
@@ -84,14 +92,20 @@  discard block
 block discarded – undo
84 92
 
85 93
 				$ips = preg_split('/ +/', CONFIG_ADMIN_IP, -1, PREG_SPLIT_NO_EMPTY);
86 94
 
87
-				if (!in_array(REQUEST_CLIENT_IP, $ips, true)) return Status::displayError404();
95
+				if (!in_array(REQUEST_CLIENT_IP, $ips, true)) {
96
+					return Status::displayError404();
97
+				}
88 98
 			}
89 99
 
90 100
 			# Handle request
91 101
 
92
-			if (($this instanceof Area\Auth) || ($this instanceof Area\Install)) return $this->handleFormArea();
102
+			if (($this instanceof Area\Auth) || ($this instanceof Area\Install)) {
103
+				return $this->handleFormArea();
104
+			}
93 105
 
94
-			if ($this instanceof Area\Panel) return $this->handlePanelArea();
106
+			if ($this instanceof Area\Panel) {
107
+				return $this->handlePanelArea();
108
+			}
95 109
 
96 110
 			# ------------------------
97 111
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Frames/Site/Section.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
 			# Check auth
35 35
 
36
-			if (Auth::isLogged()) Request::redirect(INSTALL_PATH . '/profile');
36
+			if (Auth::isLogged()) Request::redirect(INSTALL_PATH.'/profile');
37 37
 
38 38
 			# ------------------------
39 39
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
 			if (!Auth::isLogged() || ((false !== Request::get('logout')) && Auth::logout())) {
52 52
 
53
-				Request::redirect(INSTALL_PATH . '/profile/login');
53
+				Request::redirect(INSTALL_PATH.'/profile/login');
54 54
 			}
55 55
 
56 56
 			# ------------------------
Please login to merge, or discard this patch.
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -33,7 +33,9 @@  discard block
 block discarded – undo
33 33
 
34 34
 			# Check auth
35 35
 
36
-			if (Auth::isLogged()) Request::redirect(INSTALL_PATH . '/profile');
36
+			if (Auth::isLogged()) {
37
+				Request::redirect(INSTALL_PATH . '/profile');
38
+			}
37 39
 
38 40
 			# ------------------------
39 41
 
@@ -68,9 +70,13 @@  discard block
 block discarded – undo
68 70
 
69 71
 			$result = $this->handle(Request::isAjax());
70 72
 
71
-			if (Template::isBlock($result)) return (new View($this->_title, $this->_layout))->display($result);
73
+			if (Template::isBlock($result)) {
74
+				return (new View($this->_title, $this->_layout))->display($result);
75
+			}
72 76
 
73
-			if (Ajax::isResponse($result)) return Ajax::output($result);
77
+			if (Ajax::isResponse($result)) {
78
+				return Ajax::output($result);
79
+			}
74 80
 
75 81
 			# ------------------------
76 82
 
@@ -85,17 +91,27 @@  discard block
 block discarded – undo
85 91
 
86 92
 			# Check site status
87 93
 
88
-			if (Settings::get('site_status') === STATUS_MAINTENANCE) return Status::displayMaintenance();
94
+			if (Settings::get('site_status') === STATUS_MAINTENANCE) {
95
+				return Status::displayMaintenance();
96
+			}
89 97
 
90
-			if (Settings::get('site_status') === STATUS_UPDATE) return Status::displayUpdate();
98
+			if (Settings::get('site_status') === STATUS_UPDATE) {
99
+				return Status::displayUpdate();
100
+			}
91 101
 
92 102
 			# Handle request
93 103
 
94
-			if ($this instanceof Area\Auth) return $this->handleAuthArea();
104
+			if ($this instanceof Area\Auth) {
105
+				return $this->handleAuthArea();
106
+			}
95 107
 
96
-			if ($this instanceof Area\Authorized) return $this->handleAuthorizedArea();
108
+			if ($this instanceof Area\Authorized) {
109
+				return $this->handleAuthorizedArea();
110
+			}
97 111
 
98
-			if ($this instanceof Area\Common) return $this->handleCommonArea();
112
+			if ($this instanceof Area\Common) {
113
+				return $this->handleCommonArea();
114
+			}
99 115
 
100 116
 			# ------------------------
101 117
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Frames/Site/View.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,7 +38,9 @@  discard block
 block discarded – undo
38 38
 
39 39
 				$layout->getBlock('user')->name = Auth::get('name');
40 40
 
41
-				if (Auth::get('rank') === RANK_ADMINISTRATOR) $layout->getBlock('admin')->enable();
41
+				if (Auth::get('rank') === RANK_ADMINISTRATOR) {
42
+					$layout->getBlock('admin')->enable();
43
+				}
42 44
 			}
43 45
 
44 46
 			# Set title
@@ -82,7 +84,9 @@  discard block
 block discarded – undo
82 84
 
83 85
 			# Set canonical
84 86
 
85
-			if (false !== SEO::canonical()) $page->getBlock('canonical')->enable()->link = SEO::canonical();
87
+			if (false !== SEO::canonical()) {
88
+				$page->getBlock('canonical')->enable()->link = SEO::canonical();
89
+			}
86 90
 
87 91
 			# Set layout
88 92
 
@@ -90,9 +94,13 @@  discard block
 block discarded – undo
90 94
 
91 95
 			# Set global components
92 96
 
93
-			foreach (Variables::generate() as $name => $value) Template::setGlobal($name, $value);
97
+			foreach (Variables::generate() as $name => $value) {
98
+				Template::setGlobal($name, $value);
99
+			}
94 100
 
95
-			foreach (Widgets::generate() as $name => $block) Template::setWidget($name, $block);
101
+			foreach (Widgets::generate() as $name => $block) {
102
+				Template::setWidget($name, $block);
103
+			}
96 104
 
97 105
 			# ------------------------
98 106
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Frames/Section.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,10 +32,12 @@  discard block
 block discarded – undo
32 32
 
33 33
 			$phrases = (static::PHRASES + array_keys(Extend\Addons::items() ?? []));
34 34
 
35
-			foreach (array_unique($languages) as $path) foreach ($phrases as $name) {
35
+			foreach (array_unique($languages) as $path) {
36
+				foreach ($phrases as $name) {
36 37
 
37 38
 				Language::load($path . 'Phrases/' . $name . '.php');
38 39
 			}
40
+			}
39 41
 		}
40 42
 
41 43
 		/**
@@ -86,7 +88,9 @@  discard block
 block discarded – undo
86 88
 
87 89
 			# Set timezone
88 90
 
89
-			if (Auth::isLogged() && ('' !== ($timezone = Auth::get('timezone')))) date_default_timezone_set($timezone);
91
+			if (Auth::isLogged() && ('' !== ($timezone = Auth::get('timezone')))) {
92
+				date_default_timezone_set($timezone);
93
+			}
90 94
 
91 95
 			# Init utils
92 96
 
Please login to merge, or discard this patch.
www/engine/Framework/Main.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -9,26 +9,26 @@  discard block
 block discarded – undo
9 9
 
10 10
 # Define directories
11 11
 
12
-define('DIR_FRAMEWORK',     (dirname(__FILE__) . '/'));
12
+define('DIR_FRAMEWORK', (dirname(__FILE__).'/'));
13 13
 
14
-define('DIR_CLASSES',       (DIR_FRAMEWORK . 'Classes/'));
15
-define('DIR_DATA',          (DIR_FRAMEWORK . 'Data/'));
16
-define('DIR_INCLUDES',      (DIR_FRAMEWORK . 'Includes/'));
17
-define('DIR_TEMPLATES',     (DIR_FRAMEWORK . 'Templates/'));
14
+define('DIR_CLASSES', (DIR_FRAMEWORK.'Classes/'));
15
+define('DIR_DATA', (DIR_FRAMEWORK.'Data/'));
16
+define('DIR_INCLUDES', (DIR_FRAMEWORK.'Includes/'));
17
+define('DIR_TEMPLATES', (DIR_FRAMEWORK.'Templates/'));
18 18
 
19 19
 # Require classes
20 20
 
21
-require_once (DIR_FRAMEWORK . 'Engine.php');
22
-require_once (DIR_FRAMEWORK . 'Exception.php');
23
-require_once (DIR_FRAMEWORK . 'Type.php');
21
+require_once (DIR_FRAMEWORK.'Engine.php');
22
+require_once (DIR_FRAMEWORK.'Exception.php');
23
+require_once (DIR_FRAMEWORK.'Type.php');
24 24
 
25 25
 # Require configuration
26 26
 
27
-require_once (DIR_INCLUDES . 'Constants.php');
28
-require_once (DIR_INCLUDES . 'Functions.php');
29
-require_once (DIR_INCLUDES . 'Regex.php');
30
-require_once (DIR_INCLUDES . 'Headers/Mime.php');
31
-require_once (DIR_INCLUDES . 'Headers/Status.php');
27
+require_once (DIR_INCLUDES.'Constants.php');
28
+require_once (DIR_INCLUDES.'Functions.php');
29
+require_once (DIR_INCLUDES.'Regex.php');
30
+require_once (DIR_INCLUDES.'Headers/Mime.php');
31
+require_once (DIR_INCLUDES.'Headers/Status.php');
32 32
 
33 33
 # Set defaults
34 34
 
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
 
39 39
 # Set request constants
40 40
 
41
-define('REQUEST_CLIENT_IP',     Engine::getIP());
41
+define('REQUEST_CLIENT_IP', Engine::getIP());
42 42
 
43
-define('REQUEST_TIME',          $_SERVER['REQUEST_TIME']);
44
-define('REQUEST_TIME_FLOAT',    $_SERVER['REQUEST_TIME_FLOAT']);
43
+define('REQUEST_TIME', $_SERVER['REQUEST_TIME']);
44
+define('REQUEST_TIME_FLOAT', $_SERVER['REQUEST_TIME_FLOAT']);
45 45
 
46 46
 # Set exception handler
47 47
 
Please login to merge, or discard this patch.
www/engine/Framework/Classes/DB/Query.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 		protected function getValue(string $value) : string {
32 32
 
33
-			return ('\'' . addslashes($value) . '\'');
33
+			return ('\''.addslashes($value).'\'');
34 34
 		}
35 35
 
36 36
 		/**
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
 			$parser = function($value) { if (is_scalar($value)) return $this->getValue($value); };
43 43
 
44
-			return ('(' . implode(', ', array_filter(array_map($parser, $value))) . ')');
44
+			return ('('.implode(', ', array_filter(array_map($parser, $value))).')');
45 45
 		}
46 46
 
47 47
 		/**
@@ -50,21 +50,21 @@  discard block
 block discarded – undo
50 50
 
51 51
 		protected function getOperatable($value) {
52 52
 
53
-			if (is_scalar($value)) return ('= ' . $this->getValue($value));
53
+			if (is_scalar($value)) return ('= '.$this->getValue($value));
54 54
 
55
-			if (is_array($value)) return ('IN ' . $this->getRange($value));
55
+			if (is_array($value)) return ('IN '.$this->getRange($value));
56 56
 
57
-			if ($value instanceof Type\Not) return ('NOT ' . $this->getValue($value->get()));
57
+			if ($value instanceof Type\Not) return ('NOT '.$this->getValue($value->get()));
58 58
 
59
-			if ($value instanceof Type\Like) return ('LIKE ' . $this->getValue($value->get()));
59
+			if ($value instanceof Type\Like) return ('LIKE '.$this->getValue($value->get()));
60 60
 
61
-			if ($value instanceof Type\LessThan) return ('< ' . $value->get());
61
+			if ($value instanceof Type\LessThan) return ('< '.$value->get());
62 62
 
63
-			if ($value instanceof Type\GreaterThan) return ('> ' . $value->get());
63
+			if ($value instanceof Type\GreaterThan) return ('> '.$value->get());
64 64
 
65
-			if ($value instanceof Type\LessThanOrEqual) return ('<= ' . $value->get());
65
+			if ($value instanceof Type\LessThanOrEqual) return ('<= '.$value->get());
66 66
 
67
-			if ($value instanceof Type\GreaterThanOrEqual) return ('>= ' . $value->get());
67
+			if ($value instanceof Type\GreaterThanOrEqual) return ('>= '.$value->get());
68 68
 
69 69
 			# ------------------------
70 70
 
Please login to merge, or discard this patch.
Braces   +39 added lines, -13 removed lines patch added patch discarded remove patch
@@ -39,7 +39,10 @@  discard block
 block discarded – undo
39 39
 
40 40
 		protected function getRange(array $value) : string {
41 41
 
42
-			$parser = function($value) { if (is_scalar($value)) return $this->getValue($value); };
42
+			$parser = function($value) { if (is_scalar($value)) {
43
+				return $this->getValue($value);
44
+			}
45
+			};
43 46
 
44 47
 			return ('(' . implode(', ', array_filter(array_map($parser, $value))) . ')');
45 48
 		}
@@ -50,21 +53,37 @@  discard block
 block discarded – undo
50 53
 
51 54
 		protected function getOperatable($value) {
52 55
 
53
-			if (is_scalar($value)) return ('= ' . $this->getValue($value));
56
+			if (is_scalar($value)) {
57
+				return ('= ' . $this->getValue($value));
58
+			}
54 59
 
55
-			if (is_array($value)) return ('IN ' . $this->getRange($value));
60
+			if (is_array($value)) {
61
+				return ('IN ' . $this->getRange($value));
62
+			}
56 63
 
57
-			if ($value instanceof Type\Not) return ('NOT ' . $this->getValue($value->get()));
64
+			if ($value instanceof Type\Not) {
65
+				return ('NOT ' . $this->getValue($value->get()));
66
+			}
58 67
 
59
-			if ($value instanceof Type\Like) return ('LIKE ' . $this->getValue($value->get()));
68
+			if ($value instanceof Type\Like) {
69
+				return ('LIKE ' . $this->getValue($value->get()));
70
+			}
60 71
 
61
-			if ($value instanceof Type\LessThan) return ('< ' . $value->get());
72
+			if ($value instanceof Type\LessThan) {
73
+				return ('< ' . $value->get());
74
+			}
62 75
 
63
-			if ($value instanceof Type\GreaterThan) return ('> ' . $value->get());
76
+			if ($value instanceof Type\GreaterThan) {
77
+				return ('> ' . $value->get());
78
+			}
64 79
 
65
-			if ($value instanceof Type\LessThanOrEqual) return ('<= ' . $value->get());
80
+			if ($value instanceof Type\LessThanOrEqual) {
81
+				return ('<= ' . $value->get());
82
+			}
66 83
 
67
-			if ($value instanceof Type\GreaterThanOrEqual) return ('>= ' . $value->get());
84
+			if ($value instanceof Type\GreaterThanOrEqual) {
85
+				return ('>= ' . $value->get());
86
+			}
68 87
 
69 88
 			# ------------------------
70 89
 
@@ -86,7 +105,9 @@  discard block
 block discarded – undo
86 105
 
87 106
 		protected function getString($source = null, string $pattern = '', string $separator = '') : string {
88 107
 
89
-			if (!is_array($source)) return (is_scalar($source) ? strval($source) : '');
108
+			if (!is_array($source)) {
109
+				return (is_scalar($source) ? strval($source) : '');
110
+			}
90 111
 
91 112
 			$regexs = ['key' => '/\^([a-z]+)/', 'value' => '/\$([a-z]+)/']; $matches = ['key' => [], 'value' => []];
92 113
 
@@ -98,7 +119,9 @@  discard block
 block discarded – undo
98 119
 
99 120
 			# Parse pattern
100 121
 
101
-			foreach ($regexs as $name => $regex) preg_match($regex, $pattern, $matches[$name]);
122
+			foreach ($regexs as $name => $regex) {
123
+				preg_match($regex, $pattern, $matches[$name]);
124
+			}
102 125
 
103 126
 			# Process replacements
104 127
 
@@ -106,9 +129,12 @@  discard block
 block discarded – undo
106 129
 
107 130
 				$output[$count] = $pattern; $item = &$output[$count++];
108 131
 
109
-				foreach ($matches as $name => $match) if (isset($match[1]) && isset($parsers[$match[1]])) {
132
+				foreach ($matches as $name => $match) {
133
+					if (isset($match[1]) && isset($parsers[$match[1]])) {
110 134
 
111
-					try { $replace = [$this, $parsers[$match[1]]]($$name); } catch (\TypeError $e) { $replace = ''; }
135
+					try { $replace = [$this, $parsers[$match[1]]]($$name);
136
+				}
137
+				} catch (\TypeError $e) { $replace = ''; }
112 138
 
113 139
 					$item = str_replace($match[0], $replace, $item);
114 140
 				}
Please login to merge, or discard this patch.
www/engine/Framework/Classes/DB/Query/Count.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,15 +23,15 @@
 block discarded – undo
23 23
 
24 24
 			$table = $this->getName($table);
25 25
 
26
-			if ($column !== '*') $column = (($distinct ? 'DISTINCT ' : '') . $this->getName($column));
26
+			if ($column !== '*') $column = (($distinct ? 'DISTINCT ' : '').$this->getName($column));
27 27
 
28 28
 			$condition = $this->getString($condition, '^name $operatable', ' AND ');
29 29
 
30 30
 			# Build query
31 31
 
32
-			$this->query = ('SELECT COUNT(' . $column . ') as count ' .
32
+			$this->query = ('SELECT COUNT('.$column.') as count '.
33 33
 
34
-				'FROM ' . $table . ($condition ? (' WHERE (' .  $condition . ')') : ''));
34
+				'FROM '.$table.($condition ? (' WHERE ('.$condition.')') : ''));
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
@@ -23,7 +23,9 @@
 block discarded – undo
23 23
 
24 24
 			$table = $this->getName($table);
25 25
 
26
-			if ($column !== '*') $column = (($distinct ? 'DISTINCT ' : '') . $this->getName($column));
26
+			if ($column !== '*') {
27
+				$column = (($distinct ? 'DISTINCT ' : '') . $this->getName($column));
28
+			}
27 29
 
28 30
 			$condition = $this->getString($condition, '^name $operatable', ' AND ');
29 31
 
Please login to merge, or discard this patch.