Completed
Push — master ( e7c824...3ed60a )
by Anton
10s
created
www/engine/System/Classes/Modules/Entitizer/Definition.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,9 @@
 block discarded – undo
29 29
 
30 30
 		public static function get(string $type, int $id = 0) {
31 31
 
32
-			if (!isset(self::$classes[$type])) throw new Exception\General(self::$error_message);
32
+			if (!isset(self::$classes[$type])) {
33
+				throw new Exception\General(self::$error_message);
34
+			}
33 35
 
34 36
 			$cached = isset(self::$cache[$type][$id]);
35 37
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Definition/User/Secret.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@
 block discarded – undo
14 14
 
15 15
 			# Add params
16 16
 
17
-			$this->addTextual       ('code',            true, 40, true, true, true);
18
-			$this->addTextual       ('ip',              true, 255, false, true, false);
19
-			$this->addInteger       ('time',            false, 10, 0, true, false);
17
+			$this->addTextual('code', true, 40, true, true, true);
18
+			$this->addTextual('ip', true, 255, false, true, false);
19
+			$this->addInteger('time', false, 10, 0, true, false);
20 20
 		}
21 21
 	}
22 22
 }
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Handler/Menuitem.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@
 block discarded – undo
34 34
 
35 35
 				$contents->block('parent')->block('browse')->disable();
36 36
 
37
-			} else $contents->block('parent')->block('browse')->link = $this->parent->link;
37
+			} else {
38
+				$contents->block('parent')->block('browse')->link = $this->parent->link;
39
+			}
38 40
 		}
39 41
 
40 42
 		# Add item additional data
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Handler/Page.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@
 block discarded – undo
34 34
 
35 35
 				$contents->block('parent')->block('browse')->disable();
36 36
 
37
-			} else $contents->block('parent')->block('browse')->link = $this->parent->link;
37
+			} else {
38
+				$contents->block('parent')->block('browse')->link = $this->parent->link;
39
+			}
38 40
 		}
39 41
 
40 42
 		# Add item additional data
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Entitizer/Listview/Menuitems.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@
 block discarded – undo
34 34
 
35 35
 				$contents->block('parent')->block('browse')->disable();
36 36
 
37
-			} else $contents->block('parent')->block('browse')->link = $this->parent->link;
37
+			} else {
38
+				$contents->block('parent')->block('browse')->link = $this->parent->link;
39
+			}
38 40
 		}
39 41
 
40 42
 		# Add item additional data
Please login to merge, or discard this 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/Param/Type/Boolean.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@
 block discarded – undo
16 16
 
17 17
 			# Set field configuration
18 18
 
19
-			foreach (get_defined_vars() as $name => $value) $this->$name = $value;
19
+			foreach (get_defined_vars() as $name => $value) {
20
+				$this->$name = $value;
21
+			}
20 22
 		}
21 23
 
22 24
 		# Get field statement
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 
22 22
 		public function fieldStatement() {
23 23
 
24
-			return ("`" . $this->name . "` tinyint(1) unsigned NOT NULL DEFAULT '" . intval($this->default) . "'");
24
+			return ("`".$this->name."` tinyint(1) unsigned NOT NULL DEFAULT '".intval($this->default)."'");
25 25
 		}
26 26
 
27 27
 		# Cast value
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Template/Asset/Block.php 2 patches
Braces   +44 added lines, -20 removed lines patch added patch discarded remove patch
@@ -22,15 +22,19 @@  discard block
 block discarded – undo
22 22
 
23 23
 				$type = $matches[2][$key]; $name = $matches[3][$key]; $contents = ($matches[4][$key] ?? '');
24 24
 
25
-				if (!preg_match(REGEX_TEMPLATE_ITEM_NAME, $name)) continue;
25
+				if (!preg_match(REGEX_TEMPLATE_ITEM_NAME, $name)) {
26
+					continue;
27
+				}
26 28
 
27 29
 				$this->contents = str_replace($match, ('{ ' . $type . ':' . $name . ' / }'), $this->contents);
28 30
 
29
-				if ($type === 'block') $this->blocks[$name] = (new Block($contents))->$toggle();
30
-
31
-				else if ($type === 'for') $this->loops[$name] = new Loop($contents);
32
-
33
-				else if ($type === 'widget') $this->widgets[] = $name;
31
+				if ($type === 'block') {
32
+					$this->blocks[$name] = (new Block($contents))->$toggle();
33
+				} else if ($type === 'for') {
34
+					$this->loops[$name] = new Loop($contents);
35
+				} else if ($type === 'widget') {
36
+					$this->widgets[] = $name;
37
+				}
34 38
 			}
35 39
 		}
36 40
 
@@ -48,7 +52,9 @@  discard block
 block discarded – undo
48 52
 
49 53
 				foreach ($matches[1] as $index => $name) {
50 54
 
51
-					if (!preg_match(REGEX_TEMPLATE_ITEM_NAME, $name)) continue;
55
+					if (!preg_match(REGEX_TEMPLATE_ITEM_NAME, $name)) {
56
+						continue;
57
+					}
52 58
 
53 59
 					$elementaries['stack'][$name] = false;
54 60
 				}
@@ -68,29 +74,39 @@  discard block
 block discarded – undo
68 74
 
69 75
 		public function __clone() {
70 76
 
71
-			foreach ($this->blocks as $name => $block) $this->blocks[$name] = clone $block;
77
+			foreach ($this->blocks as $name => $block) {
78
+				$this->blocks[$name] = clone $block;
79
+			}
72 80
 
73
-			foreach ($this->loops as $name => $loop) $this->loops[$name] = clone $loop;
81
+			foreach ($this->loops as $name => $loop) {
82
+				$this->loops[$name] = clone $loop;
83
+			}
74 84
 		}
75 85
 
76 86
 		# Setter
77 87
 
78 88
 		public function __set(string $name, $value) {
79 89
 
80
-			if ($value instanceof Block) $this->block($name, $value);
81
-
82
-			else if (is_array($value)) $this->loop($name, $value);
83
-
84
-			else if (is_scalar($value)) $this->set($name, $value);
90
+			if ($value instanceof Block) {
91
+				$this->block($name, $value);
92
+			} else if (is_array($value)) {
93
+				$this->loop($name, $value);
94
+			} else if (is_scalar($value)) {
95
+				$this->set($name, $value);
96
+			}
85 97
 		}
86 98
 
87 99
 		# Set block
88 100
 
89 101
 		public function block(string $name, Block $block = null) {
90 102
 
91
-			if (!isset($this->blocks[$name])) return ((null === $block) ? new Block() : $this);
103
+			if (!isset($this->blocks[$name])) {
104
+				return ((null === $block) ? new Block() : $this);
105
+			}
92 106
 
93
-			if (null === $block) return $this->blocks[$name];
107
+			if (null === $block) {
108
+				return $this->blocks[$name];
109
+			}
94 110
 
95 111
 			$this->blocks[$name] = $block;
96 112
 
@@ -103,9 +119,13 @@  discard block
 block discarded – undo
103 119
 
104 120
 		public function loop(string $name, array $range = null) {
105 121
 
106
-			if (!isset($this->loops[$name])) return ((null === $range) ? new Loop() : $this);
122
+			if (!isset($this->loops[$name])) {
123
+				return ((null === $range) ? new Loop() : $this);
124
+			}
107 125
 
108
-			if (null === $range) return $this->loops[$name];
126
+			if (null === $range) {
127
+				return $this->loops[$name];
128
+			}
109 129
 
110 130
 			$this->loops[$name]->range($range);
111 131
 
@@ -118,7 +138,9 @@  discard block
 block discarded – undo
118 138
 
119 139
 		public function set(string $name, string $value) {
120 140
 
121
-			if (isset($this->variables[$name])) $this->variables[$name] = $value;
141
+			if (isset($this->variables[$name])) {
142
+				$this->variables[$name] = $value;
143
+			}
122 144
 
123 145
 			return $this;
124 146
 		}
@@ -127,7 +149,9 @@  discard block
 block discarded – undo
127 149
 
128 150
 		public function contents() {
129 151
 
130
-			if (!$this->enabled) return '';
152
+			if (!$this->enabled) {
153
+				return '';
154
+			}
131 155
 
132 156
 			$this->enabled = false; $insertions = [];
133 157
 
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 				if (!preg_match(REGEX_TEMPLATE_ITEM_NAME, $name)) continue;
26 26
 
27
-				$this->contents = str_replace($match, ('{ ' . $type . ':' . $name . ' / }'), $this->contents);
27
+				$this->contents = str_replace($match, ('{ '.$type.':'.$name.' / }'), $this->contents);
28 28
 
29 29
 				if ($type === 'block') $this->blocks[$name] = (new Block($contents))->$toggle();
30 30
 
@@ -135,14 +135,14 @@  discard block
 block discarded – undo
135 135
 
136 136
 			foreach ($this->blocks as $name => $block) {
137 137
 
138
-				$insertions['{ block:' . $name . ' / }'] = $block->contents();
138
+				$insertions['{ block:'.$name.' / }'] = $block->contents();
139 139
 			}
140 140
 
141 141
 			# Process loops
142 142
 
143 143
 			foreach ($this->loops as $name => $loop) {
144 144
 
145
-				$insertions['{ for:' . $name . ' / }'] = $loop->contents();
145
+				$insertions['{ for:'.$name.' / }'] = $loop->contents();
146 146
 			}
147 147
 
148 148
 			# Process widgets
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
 				$contents = ((false !== $widget) ? $widget->contents() : '');
155 155
 
156
-				$insertions['{ widget:' . $name . ' / }'] = $contents;
156
+				$insertions['{ widget:'.$name.' / }'] = $contents;
157 157
 			}
158 158
 
159 159
 			# Process variables
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 
163 163
 				$value = ((false === $value) ? Template::global($name) : $value);
164 164
 
165
-				$insertions['$' . $name . '$'] = Str::output($value);
165
+				$insertions['$'.$name.'$'] = Str::output($value);
166 166
 			}
167 167
 
168 168
 			# Process phrases
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
 				$value = Language::get($name);
173 173
 
174
-				$insertions['%' . $name . '%'] = Str::output($value);
174
+				$insertions['%'.$name.'%'] = Str::output($value);
175 175
 			}
176 176
 
177 177
 			# Unlock and process insertions
Please login to merge, or discard this patch.
www/engine/System/Classes/Modules/Filemanager/Utils/Handler.php 2 patches
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,13 +47,17 @@  discard block
 block discarded – undo
47 47
 
48 48
 			# Check for demo mode
49 49
 
50
-			if (Informer::isDemoMode()) return $ajax->error(Language::get('DEMO_MODE_RESTRICTION'));
50
+			if (Informer::isDemoMode()) {
51
+				return $ajax->error(Language::get('DEMO_MODE_RESTRICTION'));
52
+			}
51 53
 
52 54
 			# Remove item
53 55
 
54 56
 			if (Request::post('action') === 'remove') {
55 57
 
56
-				if (!$this->entity->remove()) return $ajax->error(Language::get(static::$message_error_remove));
58
+				if (!$this->entity->remove()) {
59
+					return $ajax->error(Language::get(static::$message_error_remove));
60
+				}
57 61
 			}
58 62
 
59 63
 			# ------------------------
@@ -84,7 +88,9 @@  discard block
 block discarded – undo
84 88
 
85 89
 			# Handle ajax request
86 90
 
87
-			if (Request::isAjax()) return $this->handleAjax();
91
+			if (Request::isAjax()) {
92
+				return $this->handleAjax();
93
+			}
88 94
 
89 95
 			# Create form
90 96
 
@@ -101,7 +107,9 @@  discard block
 block discarded – undo
101 107
 
102 108
 			# Display success message
103 109
 
104
-			if (false !== Request::get('submitted')) Messages::success(Language::get(static::$message_success_rename));
110
+			if (false !== Request::get('submitted')) {
111
+				Messages::success(Language::get(static::$message_success_rename));
112
+			}
105 113
 
106 114
 			# ------------------------
107 115
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
 
89 89
 			if (!$this->entity->init(Request::get('name'))) {
90 90
 
91
-				$query = (('' !== $this->parent->path()) ? ('?parent=' . $this->parent->path()) : '');
91
+				$query = (('' !== $this->parent->path()) ? ('?parent='.$this->parent->path()) : '');
92 92
 
93
-				Request::redirect(INSTALL_PATH . '/admin/content/filemanager' . $query);
93
+				Request::redirect(INSTALL_PATH.'/admin/content/filemanager'.$query);
94 94
 			}
95 95
 
96 96
 			# Create form
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 
102 102
 			if ($this->form->handle(new Filemanager\Controller\Rename($this->entity))) {
103 103
 
104
-				$query = ('?parent=' . $this->parent->path() . '&name=' . $this->entity->name() . '&submitted');
104
+				$query = ('?parent='.$this->parent->path().'&name='.$this->entity->name().'&submitted');
105 105
 
106
-				Request::redirect(INSTALL_PATH . '/admin/content/filemanager/' . static::$type . $query);
106
+				Request::redirect(INSTALL_PATH.'/admin/content/filemanager/'.static::$type.$query);
107 107
 			}
108 108
 
109 109
 			# Display success message
Please login to merge, or discard this patch.
www/engine/System/Classes/Utils/Uploader.php 3 patches
Braces   +45 added lines, -15 removed lines patch added patch discarded remove patch
@@ -10,19 +10,33 @@  discard block
 block discarded – undo
10 10
 
11 11
 		private static function translateError(int $error) {
12 12
 
13
-			if ($error === UPLOAD_ERR_INI_SIZE)         return 'UPLOADER_ERROR_INI_SIZE';
13
+			if ($error === UPLOAD_ERR_INI_SIZE) {
14
+				return 'UPLOADER_ERROR_INI_SIZE';
15
+			}
14 16
 
15
-			if ($error === UPLOAD_ERR_FORM_SIZE)        return 'UPLOADER_ERROR_FORM_SIZE';
17
+			if ($error === UPLOAD_ERR_FORM_SIZE) {
18
+				return 'UPLOADER_ERROR_FORM_SIZE';
19
+			}
16 20
 
17
-			if ($error === UPLOAD_ERR_PARTIAL)          return 'UPLOADER_ERROR_PARTIAL';
21
+			if ($error === UPLOAD_ERR_PARTIAL) {
22
+				return 'UPLOADER_ERROR_PARTIAL';
23
+			}
18 24
 
19
-			if ($error === UPLOAD_ERR_NO_FILE)          return 'UPLOADER_ERROR_NO_FILE';
25
+			if ($error === UPLOAD_ERR_NO_FILE) {
26
+				return 'UPLOADER_ERROR_NO_FILE';
27
+			}
20 28
 
21
-			if ($error === UPLOAD_ERR_NO_TMP_DIR)       return 'UPLOADER_ERROR_NO_TMP_DIR';
29
+			if ($error === UPLOAD_ERR_NO_TMP_DIR) {
30
+				return 'UPLOADER_ERROR_NO_TMP_DIR';
31
+			}
22 32
 
23
-			if ($error === UPLOAD_ERR_CANT_WRITE)       return 'UPLOADER_ERROR_CANT_WRITE';
33
+			if ($error === UPLOAD_ERR_CANT_WRITE) {
34
+				return 'UPLOADER_ERROR_CANT_WRITE';
35
+			}
24 36
 
25
-			if ($error === UPLOAD_ERR_EXTENSION)        return 'UPLOADER_ERROR_EXTENSION';
37
+			if ($error === UPLOAD_ERR_EXTENSION) {
38
+				return 'UPLOADER_ERROR_EXTENSION';
39
+			}
26 40
 
27 41
 			# ------------------------
28 42
 
@@ -33,39 +47,55 @@  discard block
 block discarded – undo
33 47
 
34 48
 		public static function save(string $name, string $dir_name) {
35 49
 
36
-			if ((false === ($file = Request::file($name))) || !is_uploaded_file($file['tmp_name'])) return false;
50
+			if ((false === ($file = Request::file($name))) || !is_uploaded_file($file['tmp_name'])) {
51
+				return false;
52
+			}
37 53
 
38 54
 			# Check for demo mode
39 55
 
40
-			if (Informer::isDemoMode()) return 'DEMO_MODE_RESTRICTION';
56
+			if (Informer::isDemoMode()) {
57
+				return 'DEMO_MODE_RESTRICTION';
58
+			}
41 59
 
42 60
 			# Check for upload errors
43 61
 
44
-			if ($file['error'] !== UPLOAD_ERR_OK) return self::translateError($file['error']);
62
+			if ($file['error'] !== UPLOAD_ERR_OK) {
63
+				return self::translateError($file['error']);
64
+			}
45 65
 
46 66
 			# Check size
47 67
 
48
-			if ($file['size'] > CONFIG_UPLOADS_MAX_SIZE) return 'UPLOADER_ERROR_SIZE';
68
+			if ($file['size'] > CONFIG_UPLOADS_MAX_SIZE) {
69
+				return 'UPLOADER_ERROR_SIZE';
70
+			}
49 71
 
50 72
 			# Check file extension
51 73
 
52 74
 			$extensions = ['php', 'phtml', 'php3', 'php4', 'php5', 'phps'];
53 75
 
54
-			if (in_array(Explorer::extension($file['name'], false), $extensions)) return 'UPLOADER_ERROR_TYPE';
76
+			if (in_array(Explorer::extension($file['name'], false), $extensions)) {
77
+				return 'UPLOADER_ERROR_TYPE';
78
+			}
55 79
 
56 80
 			# Check target directory
57 81
 
58
-			if (!Explorer::isDir($dir_name)) return 'UPLOADER_ERROR_DIR';
82
+			if (!Explorer::isDir($dir_name)) {
83
+				return 'UPLOADER_ERROR_DIR';
84
+			}
59 85
 
60 86
 			# Check target file
61 87
 
62 88
 			$file_name = ($dir_name . '/' . basename($file['name']));
63 89
 
64
-			if (Explorer::isDir($file_name) || Explorer::isFile($file_name)) return 'UPLOADER_ERROR_EXISTS';
90
+			if (Explorer::isDir($file_name) || Explorer::isFile($file_name)) {
91
+				return 'UPLOADER_ERROR_EXISTS';
92
+			}
65 93
 
66 94
 			# Save uploaded file
67 95
 
68
-			if (!@move_uploaded_file($file['tmp_name'], $file_name)) return 'UPLOADER_ERROR_SAVE';
96
+			if (!@move_uploaded_file($file['tmp_name'], $file_name)) {
97
+				return 'UPLOADER_ERROR_SAVE';
98
+			}
69 99
 
70 100
 			# ------------------------
71 101
 
Please login to merge, or discard this patch.
Unused Use Statements   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,11 @@
 block discarded – undo
2 2
 
3 3
 namespace Utils {
4 4
 
5
-	use Modules\Informer, Utils\Messages, Explorer, Language, Request;
5
+	use Modules\Informer;
6
+	use Utils\Messages;
7
+	use Explorer;
8
+	use Language;
9
+	use Request;
6 10
 
7 11
 	abstract class Uploader {
8 12
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
 
60 60
 			# Check target file
61 61
 
62
-			$file_name = ($dir_name . '/' . basename($file['name']));
62
+			$file_name = ($dir_name.'/'.basename($file['name']));
63 63
 
64 64
 			if (Explorer::isDir($file_name) || Explorer::isFile($file_name)) return 'UPLOADER_ERROR_EXISTS';
65 65
 
Please login to merge, or discard this patch.