Passed
Branch 0.4.0 (434eea)
by Anton
04:47
created
www/engine/System/Classes/Modules/Entitizer/Lister/Widgets.php 1 patch
Unused Use Statements   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,8 @@
 block discarded – undo
2 2
 
3 3
 namespace Modules\Entitizer\Listview {
4 4
 
5
-	use Modules\Entitizer, Template;
5
+	use Modules\Entitizer;
6
+	use Template;
6 7
 
7 8
 	class Variables extends Entitizer\Utils\Listview {
8 9
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Utils/Entity.php 4 patches
Unused Use Statements   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,8 @@
 block discarded – undo
2 2
 
3 3
 namespace Modules\Entitizer\Utils {
4 4
 
5
-	use Modules\Entitizer, DB;
5
+	use Modules\Entitizer;
6
+	use DB;
6 7
 
7 8
 	abstract class Entity extends Entitizer {
8 9
 
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,11 +24,11 @@
 block discarded – undo
24 24
 
25 25
 			$query = ("SELECT " . implode(', ', $selection) .", rel.ancestor as parent_id ") .
26 26
 
27
-			         ("FROM " . static::$table . " ent ") .
27
+					 ("FROM " . static::$table . " ent ") .
28 28
 
29
-			         ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") .
29
+					 ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") .
30 30
 
31
-			         ("WHERE ent." . $name . " = '" . addslashes($value) . "' LIMIT 1");
31
+					 ("WHERE ent." . $name . " = '" . addslashes($value) . "' LIMIT 1");
32 32
 
33 33
 			# ------------------------
34 34
 
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
18 18
 
19 19
 			$selection = array_keys($this->definition->params());
20 20
 
21
-			foreach ($selection as $key => $field) $selection[$key] = ('ent.' . $field);
21
+			foreach ($selection as $key => $field) $selection[$key] = ('ent.'.$field);
22 22
 
23 23
 			# Process query
24 24
 
25
-			$query = ("SELECT " . implode(', ', $selection) .", rel.ancestor as parent_id ") .
25
+			$query = ("SELECT ".implode(', ', $selection).", rel.ancestor as parent_id ").
26 26
 
27
-			         ("FROM " . static::$table . " ent ") .
27
+			         ("FROM ".static::$table." ent ").
28 28
 
29
-			         ("LEFT JOIN " . static::$table_relations . " rel ON rel.descendant = ent.id AND rel.depth = 1 ") .
29
+			         ("LEFT JOIN ".static::$table_relations." rel ON rel.descendant = ent.id AND rel.depth = 1 ").
30 30
 
31
-			         ("WHERE ent." . $name . " = '" . addslashes($value) . "' LIMIT 1");
31
+			         ("WHERE ent.".$name." = '".addslashes($value)."' LIMIT 1");
32 32
 
33 33
 			# ------------------------
34 34
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 
134 134
 			# Select entity from DB
135 135
 
136
-			$condition = ($name . " = '" . addslashes($value) . "' AND id != " . $this->id);
136
+			$condition = ($name." = '".addslashes($value)."' AND id != ".$this->id);
137 137
 
138 138
 			DB::select(static::$table, 'id', $condition, null, 1);
139 139
 
Please login to merge, or discard this patch.
Braces   +23 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,7 +27,9 @@  discard block
 block discarded – undo
27 27
 
28 28
 			$selection = array_keys($this->definition->params());
29 29
 
30
-			foreach ($selection as $key => $field) $selection[$key] = ('ent.' . $field);
30
+			foreach ($selection as $key => $field) {
31
+				$selection[$key] = ('ent.' . $field);
32
+			}
31 33
 
32 34
 			# Process query
33 35
 
@@ -87,13 +89,19 @@  discard block
 block discarded – undo
87 89
 
88 90
 		public function init($value, string $name = 'id') {
89 91
 
90
-			if (0 !== $this->id) return false;
92
+			if (0 !== $this->id) {
93
+				return false;
94
+			}
91 95
 
92 96
 			# Get initiation index
93 97
 
94
-			if (false === ($index = $this->definition->index($name))) return false;
98
+			if (false === ($index = $this->definition->index($name))) {
99
+				return false;
100
+			}
95 101
 
96
-			if (($index->type !== 'PRIMARY') && ($index->type !== 'UNIQUE')) return false;
102
+			if (($index->type !== 'PRIMARY') && ($index->type !== 'UNIQUE')) {
103
+				return false;
104
+			}
97 105
 
98 106
 			# Process name & value
99 107
 
@@ -101,7 +109,11 @@  discard block
 block discarded – undo
101 109
 
102 110
 			# Select entity from DB
103 111
 
104
-			if (!static::$nesting) $this->selectDefault($name, $value); else $this->selectNesting($name, $value);
112
+			if (!static::$nesting) {
113
+				$this->selectDefault($name, $value);
114
+			} else {
115
+				$this->selectNesting($name, $value);
116
+			}
105 117
 
106 118
 			# ------------------------
107 119
 
@@ -114,9 +126,13 @@  discard block
 block discarded – undo
114 126
 
115 127
 			# Get initiation index
116 128
 
117
-			if (false === ($index = $this->definition->index($name))) return false;
129
+			if (false === ($index = $this->definition->index($name))) {
130
+				return false;
131
+			}
118 132
 
119
-			if ($index->type !== 'UNIQUE') return false;
133
+			if ($index->type !== 'UNIQUE') {
134
+				return false;
135
+			}
120 136
 
121 137
 			# Process name & value
122 138
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Utils/Entity/Modify.php 4 patches
Unused Use Statements   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,8 @@
 block discarded – undo
2 2
 
3 3
 namespace Modules\Entitizer\Utils {
4 4
 
5
-	use Modules\Entitizer, DB;
5
+	use Modules\Entitizer;
6
+	use DB;
6 7
 
7 8
 	abstract class Entity extends Entitizer {
8 9
 
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
 
28 28
 			$query = ("DELETE rla FROM " . static::$table_relations . " rla ") .
29 29
 
30
-			         ("JOIN "  . static::$table_relations . " rlb ON rlb.descendant = rla.descendant ") .
30
+					 ("JOIN "  . static::$table_relations . " rlb ON rlb.descendant = rla.descendant ") .
31 31
 
32
-			         ("LEFT JOIN " . static::$table_relations . " rlx ") .
32
+					 ("LEFT JOIN " . static::$table_relations . " rlx ") .
33 33
 
34
-			         ("ON rlx.ancestor = rlb.ancestor AND rlx.descendant = rla.ancestor ") .
34
+					 ("ON rlx.ancestor = rlb.ancestor AND rlx.descendant = rla.ancestor ") .
35 35
 
36
-			         ("WHERE rlb.ancestor = " . $this->id . " AND rlx.ancestor IS NULL");
36
+					 ("WHERE rlb.ancestor = " . $this->id . " AND rlx.ancestor IS NULL");
37 37
 
38 38
 			if (!(DB::send($query) && DB::last()->status)) return false;
39 39
 
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
 
53 53
 			$query = ("INSERT INTO " . static::$table_relations . " (ancestor, descendant, depth) ") .
54 54
 
55
-			         ("SELECT sup.ancestor, sub.descendant, sup.depth + sub.depth + 1 ") .
55
+					 ("SELECT sup.ancestor, sub.descendant, sup.depth + sub.depth + 1 ") .
56 56
 
57
-			         ("FROM " . static::$table_relations . " sup ") .
57
+					 ("FROM " . static::$table_relations . " sup ") .
58 58
 
59
-			         ("JOIN " . static::$table_relations . " sub ") .
59
+					 ("JOIN " . static::$table_relations . " sub ") .
60 60
 
61
-			         ("WHERE sub.ancestor = " . $this->id . " AND sup.descendant = " . $parent_id);
61
+					 ("WHERE sub.ancestor = " . $this->id . " AND sup.descendant = " . $parent_id);
62 62
 
63 63
 			if (!(DB::send($query) && DB::last()->status)) return false;
64 64
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -25,15 +25,15 @@  discard block
 block discarded – undo
25 25
 
26 26
 		private function disconnectSubtree() {
27 27
 
28
-			$query = ("DELETE rla FROM " . static::$table_relations . " rla ") .
28
+			$query = ("DELETE rla FROM ".static::$table_relations." rla ").
29 29
 
30
-			         ("JOIN "  . static::$table_relations . " rlb ON rlb.descendant = rla.descendant ") .
30
+			         ("JOIN ".static::$table_relations." rlb ON rlb.descendant = rla.descendant ").
31 31
 
32
-			         ("LEFT JOIN " . static::$table_relations . " rlx ") .
32
+			         ("LEFT JOIN ".static::$table_relations." rlx ").
33 33
 
34
-			         ("ON rlx.ancestor = rlb.ancestor AND rlx.descendant = rla.ancestor ") .
34
+			         ("ON rlx.ancestor = rlb.ancestor AND rlx.descendant = rla.ancestor ").
35 35
 
36
-			         ("WHERE rlb.ancestor = " . $this->id . " AND rlx.ancestor IS NULL");
36
+			         ("WHERE rlb.ancestor = ".$this->id." AND rlx.ancestor IS NULL");
37 37
 
38 38
 			if (!(DB::send($query) && DB::last()->status)) return false;
39 39
 
@@ -50,15 +50,15 @@  discard block
 block discarded – undo
50 50
 
51 51
 		private function connectSubtree(int $parent_id) {
52 52
 
53
-			$query = ("INSERT INTO " . static::$table_relations . " (ancestor, descendant, depth) ") .
53
+			$query = ("INSERT INTO ".static::$table_relations." (ancestor, descendant, depth) ").
54 54
 
55
-			         ("SELECT sup.ancestor, sub.descendant, sup.depth + sub.depth + 1 ") .
55
+			         ("SELECT sup.ancestor, sub.descendant, sup.depth + sub.depth + 1 ").
56 56
 
57
-			         ("FROM " . static::$table_relations . " sup ") .
57
+			         ("FROM ".static::$table_relations." sup ").
58 58
 
59
-			         ("JOIN " . static::$table_relations . " sub ") .
59
+			         ("JOIN ".static::$table_relations." sub ").
60 60
 
61
-			         ("WHERE sub.ancestor = " . $this->id . " AND sup.descendant = " . $parent_id);
61
+			         ("WHERE sub.ancestor = ".$this->id." AND sup.descendant = ".$parent_id);
62 62
 
63 63
 			if (!(DB::send($query) && DB::last()->status)) return false;
64 64
 
Please login to merge, or discard this patch.
Braces   +66 added lines, -22 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@  discard block
 block discarded – undo
35 35
 
36 36
 			         ("WHERE rlb.ancestor = " . $this->id . " AND rlx.ancestor IS NULL");
37 37
 
38
-			if (!(DB::send($query) && DB::getLast()->status)) return false;
38
+			if (!(DB::send($query) && DB::getLast()->status)) {
39
+				return false;
40
+			}
39 41
 
40 42
 			# Set path
41 43
 
@@ -60,7 +62,9 @@  discard block
 block discarded – undo
60 62
 
61 63
 			         ("WHERE sub.ancestor = " . $this->id . " AND sup.descendant = " . $parent_id);
62 64
 
63
-			if (!(DB::send($query) && (DB::getLast()->rows > 0))) return false;
65
+			if (!(DB::send($query) && (DB::getLast()->rows > 0))) {
66
+				return false;
67
+			}
64 68
 
65 69
 			# Set path
66 70
 
@@ -75,27 +79,37 @@  discard block
 block discarded – undo
75 79
 
76 80
 		public function create(array $data) {
77 81
 
78
-			if (0 !== $this->id) return false;
82
+			if (0 !== $this->id) {
83
+				return false;
84
+			}
79 85
 
80 86
 			$data = $this->dataset->cast($data);
81 87
 
82
-			if (static::$auto_increment && isset($data['id'])) $data['id'] = 0;
88
+			if (static::$auto_increment && isset($data['id'])) {
89
+				$data['id'] = 0;
90
+			}
83 91
 
84 92
 			# Insert entity
85 93
 
86 94
 			DB::insert(static::$table, $data);
87 95
 
88
-			if (!(DB::getLast() && DB::getLast()->status)) return false;
96
+			if (!(DB::getLast() && DB::getLast()->status)) {
97
+				return false;
98
+			}
89 99
 
90 100
 			# Update data
91 101
 
92
-			if (static::$auto_increment) $data['id'] = DB::getLast()->id;
102
+			if (static::$auto_increment) {
103
+				$data['id'] = DB::getLast()->id;
104
+			}
93 105
 
94 106
 			$this->dataset->update($data);
95 107
 
96 108
 			# Init subtreee
97 109
 
98
-			if (static::$nesting) $this->initSubtree();
110
+			if (static::$nesting) {
111
+				$this->initSubtree();
112
+			}
99 113
 
100 114
 			# Cache entity
101 115
 
@@ -110,17 +124,23 @@  discard block
 block discarded – undo
110 124
 
111 125
 		public function edit(array $data) {
112 126
 
113
-			if (0 === $this->id) return false;
127
+			if (0 === $this->id) {
128
+				return false;
129
+			}
114 130
 
115 131
 			$data = $this->dataset->cast($data);
116 132
 
117
-			if (isset($data['id'])) unset($data['id']);
133
+			if (isset($data['id'])) {
134
+				unset($data['id']);
135
+			}
118 136
 
119 137
 			# Update entity
120 138
 
121 139
 			DB::update(static::$table, $data, ['id' => $this->id]);
122 140
 
123
-			if (!(DB::getLast() && DB::getLast()->status)) return false;
141
+			if (!(DB::getLast() && DB::getLast()->status)) {
142
+				return false;
143
+			}
124 144
 
125 145
 			# Update data
126 146
 
@@ -128,7 +148,9 @@  discard block
 block discarded – undo
128 148
 
129 149
 			# Init subtreee
130 150
 
131
-			if (static::$nesting) $this->initSubtree();
151
+			if (static::$nesting) {
152
+				$this->initSubtree();
153
+			}
132 154
 
133 155
 			# ------------------------
134 156
 
@@ -139,30 +161,44 @@  discard block
 block discarded – undo
139 161
 
140 162
 		public function move(int $parent_id) {
141 163
 
142
-			if (0 === $this->id) return false;
164
+			if (0 === $this->id) {
165
+				return false;
166
+			}
143 167
 
144 168
 			# Re-connect entity if not in tree
145 169
 
146
-			if (!$this->initSubtree()) return false;
170
+			if (!$this->initSubtree()) {
171
+				return false;
172
+			}
147 173
 
148 174
 			# Create parent entity
149 175
 
150 176
 			if (0 !== ($parent = Entitizer::get(static::$table, $parent_id))->id) {
151 177
 
152
-				if (false === ($path = $parent->path())) return false;
178
+				if (false === ($path = $parent->path())) {
179
+					return false;
180
+				}
153 181
 
154
-				if (false === ($depth = $this->subtreeDepth())) return false;
182
+				if (false === ($depth = $this->subtreeDepth())) {
183
+					return false;
184
+				}
155 185
 
156
-				if ((count($path) + $depth + 1) > CONFIG_ENTITIZER_MAX_DEPTH) return false;
186
+				if ((count($path) + $depth + 1) > CONFIG_ENTITIZER_MAX_DEPTH) {
187
+					return false;
188
+				}
157 189
 			}
158 190
 
159 191
 			# Disconnect subtree from current position
160 192
 
161
-			if (!$this->disconnectSubtree()) return false;
193
+			if (!$this->disconnectSubtree()) {
194
+				return false;
195
+			}
162 196
 
163 197
 			# Connect subtree under new position
164 198
 
165
-		 	if (0 !== $parent->id) $this->connectSubtree($parent->id);
199
+		 	if (0 !== $parent->id) {
200
+		 		$this->connectSubtree($parent->id);
201
+		 	}
166 202
 
167 203
 			# ------------------------
168 204
 
@@ -173,19 +209,27 @@  discard block
 block discarded – undo
173 209
 
174 210
 		public function remove() {
175 211
 
176
-			if (0 === $this->id) return false;
212
+			if (0 === $this->id) {
213
+				return false;
214
+			}
177 215
 
178 216
 			# Check if entity is removable
179 217
 
180
-			if (static::$super && ($this->id === 1)) return false;
218
+			if (static::$super && ($this->id === 1)) {
219
+				return false;
220
+			}
181 221
 
182
-			if (static::$nesting && (0 !== $this->subtreeCount())) return false;
222
+			if (static::$nesting && (0 !== $this->subtreeCount())) {
223
+				return false;
224
+			}
183 225
 
184 226
 			# Remove entity
185 227
 
186 228
 			DB::delete(static::$table, ['id' => $this->id]);
187 229
 
188
-			if (!(DB::getLast() && DB::getLast()->status)) return false;
230
+			if (!(DB::getLast() && DB::getLast()->status)) {
231
+				return false;
232
+			}
189 233
 
190 234
 			# Uncache entity
191 235
 
Please login to merge, or discard this patch.
www/engine/Framework/Classes/DB/Query/Insert.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@
 block discarded – undo
24 24
 
25 25
 				if (0 === $key) $names = $this->getString(array_keys($row), '$name', ', ');
26 26
 
27
-				$values[] = ('(' . $this->getString(array_values($row), '$value', ', ') . ')');
27
+				$values[] = ('('.$this->getString(array_values($row), '$value', ', ').')');
28 28
 			}
29 29
 
30 30
 			# Build query
31 31
 
32
-			$this->query = ('INSERT ' . ($ignore ? 'IGNORE ' : '') .
32
+			$this->query = ('INSERT '.($ignore ? 'IGNORE ' : '').
33 33
 
34
-				'INTO ' . $table . ' (' . $names . ') VALUES ' . implode(', ', $values));
34
+				'INTO '.$table.' ('.$names.') VALUES '.implode(', ', $values));
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
@@ -29,9 +29,11 @@
 block discarded – undo
29 29
 
30 30
 			$names = ''; $values = [];
31 31
 
32
-			foreach ($set as $key => $row) if (is_array($row)) {
32
+			foreach ($set as $key => $row) {
33
+				if (is_array($row)) {
33 34
 
34 35
 				if (0 === $key) $names = $this->getString(array_keys($row), '$name', ', ');
36
+			}
35 37
 
36 38
 				$values[] = ('(' . $this->getString(array_values($row), '$value', ', ') . ')');
37 39
 			}
Please login to merge, or discard this patch.
www/engine/System/Includes/Tables.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -2,15 +2,15 @@
 block discarded – undo
2 2
 
3 3
 # Database tables
4 4
 
5
-define('TABLE_PAGES',                               'pages');
6
-define('TABLE_PAGES_RELATIONS',                     'pages_relations');
5
+define('TABLE_PAGES', 'pages');
6
+define('TABLE_PAGES_RELATIONS', 'pages_relations');
7 7
 
8
-define('TABLE_MENU',                                'menu');
9
-define('TABLE_MENU_RELATIONS',                      'menu_relations');
8
+define('TABLE_MENU', 'menu');
9
+define('TABLE_MENU_RELATIONS', 'menu_relations');
10 10
 
11
-define('TABLE_VARIABLES',                           'variables');
12
-define('TABLE_WIDGETS',                             'widgets');
11
+define('TABLE_VARIABLES', 'variables');
12
+define('TABLE_WIDGETS', 'widgets');
13 13
 
14
-define('TABLE_USERS',                               'users');
15
-define('TABLE_USERS_SECRETS',                       'users_secrets');
16
-define('TABLE_USERS_SESSIONS',                      'users_sessions');
14
+define('TABLE_USERS', 'users');
15
+define('TABLE_USERS_SECRETS', 'users_secrets');
16
+define('TABLE_USERS_SESSIONS', 'users_sessions');
Please login to merge, or discard this patch.
www/engine/System/Includes/Config.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -2,126 +2,126 @@
 block discarded – undo
2 2
 
3 3
 # Admin ip
4 4
 
5
-define('CONFIG_ADMIN_IP',                           '');
5
+define('CONFIG_ADMIN_IP', '');
6 6
 
7 7
 # Session
8 8
 
9
-define('CONFIG_SESSION_NAME',                       '_sessid');
10
-define('CONFIG_SESSION_LIFETIME',                   2592000);       # 30 days
9
+define('CONFIG_SESSION_NAME', '_sessid');
10
+define('CONFIG_SESSION_LIFETIME', 2592000); # 30 days
11 11
 
12 12
 # Language
13 13
 
14
-define('CONFIG_LANGUAGE_COOKIE_EXPIRES',            30758400);      # 356 days
14
+define('CONFIG_LANGUAGE_COOKIE_EXPIRES', 30758400); # 356 days
15 15
 
16 16
 # Template
17 17
 
18
-define('CONFIG_TEMPLATE_COOKIE_EXPIRES',            30758400);      # 356 days
18
+define('CONFIG_TEMPLATE_COOKIE_EXPIRES', 30758400); # 356 days
19 19
 
20 20
 # Entitizer
21 21
 
22
-define('CONFIG_ENTITIZER_MAX_DEPTH',                6);
22
+define('CONFIG_ENTITIZER_MAX_DEPTH', 6);
23 23
 
24 24
 # Page
25 25
 
26
-define('CONFIG_PAGE_TITLE_MAX_LENGTH',              255);
27
-define('CONFIG_PAGE_NAME_MAX_LENGTH',               40);
28
-define('CONFIG_PAGE_DESCRIPTION_MAX_LENGTH',        512);
29
-define('CONFIG_PAGE_KEYWORDS_MAX_LENGTH',           512);
26
+define('CONFIG_PAGE_TITLE_MAX_LENGTH', 255);
27
+define('CONFIG_PAGE_NAME_MAX_LENGTH', 40);
28
+define('CONFIG_PAGE_DESCRIPTION_MAX_LENGTH', 512);
29
+define('CONFIG_PAGE_KEYWORDS_MAX_LENGTH', 512);
30 30
 
31 31
 # Menuitem
32 32
 
33
-define('CONFIG_MENUITEM_TEXT_MAX_LENGTH',           255);
34
-define('CONFIG_MENUITEM_SLUG_MAX_LENGTH',           255);
35
-define('CONFIG_MENUITEM_POSITION_MAX_LENGTH',       2);
33
+define('CONFIG_MENUITEM_TEXT_MAX_LENGTH', 255);
34
+define('CONFIG_MENUITEM_SLUG_MAX_LENGTH', 255);
35
+define('CONFIG_MENUITEM_POSITION_MAX_LENGTH', 2);
36 36
 
37 37
 # Variables
38 38
 
39
-define('CONFIG_VARIABLE_TITLE_MAX_LENGTH',          64);
40
-define('CONFIG_VARIABLE_NAME_MAX_LENGTH',           32);
41
-define('CONFIG_VARIABLE_VALUE_MAX_LENGTH',          255);
39
+define('CONFIG_VARIABLE_TITLE_MAX_LENGTH', 64);
40
+define('CONFIG_VARIABLE_NAME_MAX_LENGTH', 32);
41
+define('CONFIG_VARIABLE_VALUE_MAX_LENGTH', 255);
42 42
 
43 43
 # Widgets
44 44
 
45
-define('CONFIG_WIDGET_TITLE_MAX_LENGTH',            64);
46
-define('CONFIG_WIDGET_NAME_MAX_LENGTH',             32);
45
+define('CONFIG_WIDGET_TITLE_MAX_LENGTH', 64);
46
+define('CONFIG_WIDGET_NAME_MAX_LENGTH', 32);
47 47
 
48 48
 # Filemanager
49 49
 
50
-define('CONFIG_FILEMANAGER_NAME_MAX_LENGTH',        128);
50
+define('CONFIG_FILEMANAGER_NAME_MAX_LENGTH', 128);
51 51
 
52 52
 # User
53 53
 
54
-define('CONFIG_USER_SESSION_LIFETIME',              604800);        # 7 days
55
-define('CONFIG_USER_SECRET_LIFETIME',               86400);         # 1 day
54
+define('CONFIG_USER_SESSION_LIFETIME', 604800); # 7 days
55
+define('CONFIG_USER_SECRET_LIFETIME', 86400); # 1 day
56 56
 
57
-define('CONFIG_USER_NAME_MIN_LENGTH',               4);
58
-define('CONFIG_USER_NAME_MAX_LENGTH',               16);
57
+define('CONFIG_USER_NAME_MIN_LENGTH', 4);
58
+define('CONFIG_USER_NAME_MAX_LENGTH', 16);
59 59
 
60
-define('CONFIG_USER_PASSWORD_MIN_LENGTH',           4);
61
-define('CONFIG_USER_PASSWORD_MAX_LENGTH',           32);
60
+define('CONFIG_USER_PASSWORD_MIN_LENGTH', 4);
61
+define('CONFIG_USER_PASSWORD_MAX_LENGTH', 32);
62 62
 
63
-define('CONFIG_USER_EMAIL_MAX_LENGTH',              128);
63
+define('CONFIG_USER_EMAIL_MAX_LENGTH', 128);
64 64
 
65
-define('CONFIG_USER_FIRST_NAME_MAX_LENGTH',         32);
66
-define('CONFIG_USER_LAST_NAME_MAX_LENGTH',          32);
65
+define('CONFIG_USER_FIRST_NAME_MAX_LENGTH', 32);
66
+define('CONFIG_USER_LAST_NAME_MAX_LENGTH', 32);
67 67
 
68
-define('CONFIG_USER_CITY_MAX_LENGTH',               32);
68
+define('CONFIG_USER_CITY_MAX_LENGTH', 32);
69 69
 
70
-define('CONFIG_USER_CAPTCHA_MAX_LENGTH',            16);
70
+define('CONFIG_USER_CAPTCHA_MAX_LENGTH', 16);
71 71
 
72 72
 # Captcha
73 73
 
74
-define('CONFIG_CAPTCHA_LENGTH',                     5);
74
+define('CONFIG_CAPTCHA_LENGTH', 5);
75 75
 
76
-define('CONFIG_CAPTCHA_WIDTH',                      150);
77
-define('CONFIG_CAPTCHA_HEIGHT',                     40);
76
+define('CONFIG_CAPTCHA_WIDTH', 150);
77
+define('CONFIG_CAPTCHA_HEIGHT', 40);
78 78
 
79
-define('CONFIG_CAPTCHA_FONT',                       'Fonts/airstrip.ttf');
80
-define('CONFIG_CAPTCHA_FONT_SIZE',                  20);
79
+define('CONFIG_CAPTCHA_FONT', 'Fonts/airstrip.ttf');
80
+define('CONFIG_CAPTCHA_FONT_SIZE', 20);
81 81
 
82
-define('CONFIG_CAPTCHA_TEXT_INDENT',                15);
83
-define('CONFIG_CAPTCHA_TEXT_STEP',                  25);
82
+define('CONFIG_CAPTCHA_TEXT_INDENT', 15);
83
+define('CONFIG_CAPTCHA_TEXT_STEP', 25);
84 84
 
85 85
 # Admin
86 86
 
87
-define('CONFIG_ADMIN_LANGUAGE_DEFAULT',             'en-US');
88
-define('CONFIG_ADMIN_TEMPLATE_DEFAULT',             'Default');
87
+define('CONFIG_ADMIN_LANGUAGE_DEFAULT', 'en-US');
88
+define('CONFIG_ADMIN_TEMPLATE_DEFAULT', 'Default');
89 89
 
90
-define('CONFIG_ADMIN_PAGES_DISPLAY',                50);
91
-define('CONFIG_ADMIN_MENUITEMS_DISPLAY',            50);
92
-define('CONFIG_ADMIN_VARIABLES_DISPLAY',            50);
93
-define('CONFIG_ADMIN_WIDGETS_DISPLAY',              50);
94
-define('CONFIG_ADMIN_USERS_DISPLAY',                50);
90
+define('CONFIG_ADMIN_PAGES_DISPLAY', 50);
91
+define('CONFIG_ADMIN_MENUITEMS_DISPLAY', 50);
92
+define('CONFIG_ADMIN_VARIABLES_DISPLAY', 50);
93
+define('CONFIG_ADMIN_WIDGETS_DISPLAY', 50);
94
+define('CONFIG_ADMIN_USERS_DISPLAY', 50);
95 95
 
96
-define('CONFIG_ADMIN_FILEMANAGER_ITEMS_DISPLAY',    50);
96
+define('CONFIG_ADMIN_FILEMANAGER_ITEMS_DISPLAY', 50);
97 97
 
98 98
 # Site
99 99
 
100
-define('CONFIG_SITE_LANGUAGE_DEFAULT',              'en-US');
101
-define('CONFIG_SITE_TEMPLATE_DEFAULT',              'Default');
100
+define('CONFIG_SITE_LANGUAGE_DEFAULT', 'en-US');
101
+define('CONFIG_SITE_TEMPLATE_DEFAULT', 'Default');
102 102
 
103
-define('CONFIG_SITE_TITLE_DEFAULT',                 'Demo Site');
104
-define('CONFIG_SITE_SLOGAN_DEFAULT',                'A place for site slogan');
103
+define('CONFIG_SITE_TITLE_DEFAULT', 'Demo Site');
104
+define('CONFIG_SITE_SLOGAN_DEFAULT', 'A place for site slogan');
105 105
 
106
-define('CONFIG_SITE_TITLE_MAX_LENGTH',              128);
107
-define('CONFIG_SITE_SLOGAN_MAX_LENGTH',             255);
108
-define('CONFIG_SITE_DESCRIPTION_MAX_LENGTH',        512);
109
-define('CONFIG_SITE_KEYWORDS_MAX_LENGTH',           512);
106
+define('CONFIG_SITE_TITLE_MAX_LENGTH', 128);
107
+define('CONFIG_SITE_SLOGAN_MAX_LENGTH', 255);
108
+define('CONFIG_SITE_DESCRIPTION_MAX_LENGTH', 512);
109
+define('CONFIG_SITE_KEYWORDS_MAX_LENGTH', 512);
110 110
 
111 111
 # System
112 112
 
113
-define('CONFIG_SYSTEM_URL_MAX_LENGTH',              128);
114
-define('CONFIG_SYSTEM_EMAIL_MAX_LENGTH',            128);
113
+define('CONFIG_SYSTEM_URL_MAX_LENGTH', 128);
114
+define('CONFIG_SYSTEM_EMAIL_MAX_LENGTH', 128);
115 115
 
116
-define('CONFIG_SYSTEM_TIMEZONE_DEFAULT',            'UTC');
116
+define('CONFIG_SYSTEM_TIMEZONE_DEFAULT', 'UTC');
117 117
 
118 118
 # Database
119 119
 
120
-define('CONFIG_DATABASE_SERVER_MAX_LENGTH',         128);
121
-define('CONFIG_DATABASE_USER_MAX_LENGTH',           64);
122
-define('CONFIG_DATABASE_PASSWORD_MAX_LENGTH',       64);
123
-define('CONFIG_DATABASE_NAME_MAX_LENGTH',           64);
120
+define('CONFIG_DATABASE_SERVER_MAX_LENGTH', 128);
121
+define('CONFIG_DATABASE_USER_MAX_LENGTH', 64);
122
+define('CONFIG_DATABASE_PASSWORD_MAX_LENGTH', 64);
123
+define('CONFIG_DATABASE_NAME_MAX_LENGTH', 64);
124 124
 
125 125
 # Other
126 126
 
127
-define('CONFIG_UPLOADS_MAX_SIZE',                   104857600);  # 100 MB
127
+define('CONFIG_UPLOADS_MAX_SIZE', 104857600); # 100 MB
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Auth/Controller/Recover.php 1 patch
Braces   +12 added lines, -6 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,13 +24,15 @@  discard block
 block discarded – undo
22 24
 
23 25
 			# Validate values
24 26
 
25
-			if (false === ($password_new = Validate::userPassword($password_new)))
26
-
27
+			if (false === ($password_new = Validate::userPassword($password_new))) {
28
+			
27 29
 				return ['password_new', 'USER_ERROR_PASSWORD_NEW_INVALID'];
30
+			}
28 31
 
29
-			if (0 !== strcmp($password_new, $password_retype))
30
-
32
+			if (0 !== strcmp($password_new, $password_retype)) {
33
+			
31 34
 				return ['password_retype', 'USER_ERROR_PASSWORD_MISMATCH'];
35
+			}
32 36
 
33 37
 			# Encode password
34 38
 
@@ -38,7 +42,9 @@  discard block
 block discarded – undo
38 42
 
39 43
 			$data = ['auth_key' => $auth_key, 'password' => $password];
40 44
 
41
-			if (!Auth::user()->edit($data)) return 'USER_ERROR_AUTH_RECOVER';
45
+			if (!Auth::user()->edit($data)) {
46
+				return 'USER_ERROR_AUTH_RECOVER';
47
+			}
42 48
 
43 49
 			# Remove secret
44 50
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Auth/Controller/Register.php 1 patch
Braces   +33 added lines, -11 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,15 +24,25 @@  discard block
 block discarded – undo
22 24
 
23 25
 			# Validate values
24 26
 
25
-			if (false === ($name = Validate::userName($name))) return ['name', 'USER_ERROR_NAME_INVALID'];
27
+			if (false === ($name = Validate::userName($name))) {
28
+				return ['name', 'USER_ERROR_NAME_INVALID'];
29
+			}
26 30
 
27
-			if (false === ($password = Validate::userPassword($password))) return ['password', 'USER_ERROR_PASSWORD_INVALID'];
31
+			if (false === ($password = Validate::userPassword($password))) {
32
+				return ['password', 'USER_ERROR_PASSWORD_INVALID'];
33
+			}
28 34
 
29
-			if (false === ($email = Validate::userEmail($email))) return ['email', 'USER_ERROR_EMAIL_INVALID'];
35
+			if (false === ($email = Validate::userEmail($email))) {
36
+				return ['email', 'USER_ERROR_EMAIL_INVALID'];
37
+			}
30 38
 
31
-			if (0 !== strcmp($password, $password_retype)) return ['password_retype', 'USER_ERROR_PASSWORD_MISMATCH'];
39
+			if (0 !== strcmp($password, $password_retype)) {
40
+				return ['password_retype', 'USER_ERROR_PASSWORD_MISMATCH'];
41
+			}
32 42
 
33
-			if (false === Security::checkCaptcha($captcha)) return ['captcha', 'USER_ERROR_CAPTCHA_INCORRECT'];
43
+			if (false === Security::checkCaptcha($captcha)) {
44
+				return ['captcha', 'USER_ERROR_CAPTCHA_INCORRECT'];
45
+			}
34 46
 
35 47
 			# Create user object
36 48
 
@@ -38,15 +50,23 @@  discard block
 block discarded – undo
38 50
 
39 51
 			# Check name exists
40 52
 
41
-			if (false === ($check_name = $user->check($name, 'name'))) return 'USER_ERROR_AUTH_REGISTER';
53
+			if (false === ($check_name = $user->check($name, 'name'))) {
54
+				return 'USER_ERROR_AUTH_REGISTER';
55
+			}
42 56
 
43
-			if ($check_name === 1) return ['name', 'USER_ERROR_NAME_DUPLICATE'];
57
+			if ($check_name === 1) {
58
+				return ['name', 'USER_ERROR_NAME_DUPLICATE'];
59
+			}
44 60
 
45 61
 			# Check email exists
46 62
 
47
-			if (false === ($check_email = $user->check($email, 'email'))) return 'USER_ERROR_AUTH_REGISTER';
63
+			if (false === ($check_email = $user->check($email, 'email'))) {
64
+				return 'USER_ERROR_AUTH_REGISTER';
65
+			}
48 66
 
49
-			if ($check_email === 1) return ['email', 'USER_ERROR_EMAIL_DUPLICATE'];
67
+			if ($check_email === 1) {
68
+				return ['email', 'USER_ERROR_EMAIL_DUPLICATE'];
69
+			}
50 70
 
51 71
 			# Encode password
52 72
 
@@ -69,7 +89,9 @@  discard block
 block discarded – undo
69 89
 			$data['time_registered']    = REQUEST_TIME;
70 90
 			$data['time_logged']        = REQUEST_TIME;
71 91
 
72
-			if (!$user->create($data)) return 'USER_ERROR_AUTH_REGISTER';
92
+			if (!$user->create($data)) {
93
+				return 'USER_ERROR_AUTH_REGISTER';
94
+			}
73 95
 
74 96
 			# Send mail
75 97
 
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 = Validate::userName($name))) return ['name', 'USER_ERROR_NAME_INVALID'];
27
+			if (false === ($name = Validate::userName($name))) {
28
+				return ['name', 'USER_ERROR_NAME_INVALID'];
29
+			}
26 30
 
27
-			if (false === Security::checkCaptcha($captcha)) return ['captcha', 'USER_ERROR_CAPTCHA_INCORRECT'];
31
+			if (false === Security::checkCaptcha($captcha)) {
32
+				return ['captcha', '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 ['name', 'USER_ERROR_NAME_INCORRECT'];
41
+			if (!$user->init($name, 'name')) {
42
+				return ['name', 'USER_ERROR_NAME_INCORRECT'];
43
+			}
36 44
 
37
-			if (Auth::admin() && ($user->rank < RANK_ADMINISTRATOR)) return ['name', 'USER_ERROR_NAME_INCORRECT'];
45
+			if (Auth::admin() && ($user->rank < RANK_ADMINISTRATOR)) {
46
+				return ['name', '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.