Passed
Pull Request — master (#10)
by Anton
04:10
created
www/engine/Framework/Classes/Arr/Arr.php 1 patch
Braces   +20 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,7 +10,12 @@  discard block
 block discarded – undo
10 10
 
11 11
 			$value = false;
12 12
 
13
-			foreach ($path as $item) if (isset($array[$item])) $value = ($array = $array[$item]); else return false;
13
+			foreach ($path as $item) {
14
+				if (isset($array[$item])) $value = ($array = $array[$item]);
15
+			}
16
+			else {
17
+				return false;
18
+			}
14 19
 
15 20
 			# ------------------------
16 21
 
@@ -23,10 +28,12 @@  discard block
 block discarded – undo
23 28
 
24 29
 			$result = [];
25 30
 
26
-			foreach ($keys as $key) if (is_scalar($key)) {
31
+			foreach ($keys as $key) {
32
+				if (is_scalar($key)) {
27 33
 
28 34
 				$result[$key] = ((isset($array[$key]) && is_scalar($array[$key])) ? $array[$key] : false);
29 35
 			}
36
+			}
30 37
 
31 38
 			# ------------------------
32 39
 
@@ -39,7 +46,9 @@  discard block
 block discarded – undo
39 46
 
40 47
 			$result = [];
41 48
 
42
-			foreach ($array as $key => $value) $result[] = [$key_name => $key, $value_name => $value];
49
+			foreach ($array as $key => $value) {
50
+				$result[] = [$key_name => $key, $value_name => $value];
51
+			}
43 52
 
44 53
 			# ------------------------
45 54
 
@@ -57,9 +66,15 @@  discard block
 block discarded – undo
57 66
 
58 67
 			$result = []; $column = array_map($select_key, $array);
59 68
 
60
-			if (!$descending) asort($column); else arsort($column);
69
+			if (!$descending) {
70
+				asort($column);
71
+			} else {
72
+				arsort($column);
73
+			}
61 74
 
62
-			foreach (array_keys($column) as $key) $result[$key] = $array[$key];
75
+			foreach (array_keys($column) as $key) {
76
+				$result[$key] = $array[$key];
77
+			}
63 78
 
64 79
 			# ------------------------
65 80
 
Please login to merge, or discard this patch.
www/engine/Framework/Classes/Ajax/Utils/Response.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
 		public function set(string $name, $value) {
12 12
 
13
-			if (is_scalar($value)) $this->data[$name] = $value;
13
+			if (is_scalar($value)) {
14
+				$this->data[$name] = $value;
15
+			}
14 16
 
15 17
 			return $this;
16 18
 		}
Please login to merge, or discard this patch.
www/engine/Framework/Classes/DB/Query/Insert.php 1 patch
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.
www/engine/Main.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,18 +10,18 @@  discard block
 block discarded – undo
10 10
 
11 11
 # Define constants
12 12
 
13
-define('DIR_ENGINE',        (dirname(__FILE__) . '/'));
13
+define('DIR_ENGINE', (dirname(__FILE__).'/'));
14 14
 
15
-define('DIR_WWW',           (DIR_ENGINE . '../'));
16
-define('DIR_UPLOADS',       (DIR_ENGINE . '../uploads/'));
15
+define('DIR_WWW', (DIR_ENGINE.'../'));
16
+define('DIR_UPLOADS', (DIR_ENGINE.'../uploads/'));
17 17
 
18 18
 # Require framework main file
19 19
 
20
-require_once(DIR_ENGINE . 'Framework/Main.php');
20
+require_once(DIR_ENGINE.'Framework/Main.php');
21 21
 
22 22
 # Require system main file
23 23
 
24
-require_once(DIR_ENGINE . 'System/Main.php');
24
+require_once(DIR_ENGINE.'System/Main.php');
25 25
 
26 26
 # Register classes autoloader
27 27
 
@@ -33,13 +33,13 @@  discard block
 block discarded – undo
33 33
 
34 34
 	$system_classes = ['Frames', 'Handlers', 'Modules', 'Utils', 'Views', 'Dispatcher', 'Installer'];
35 35
 
36
-	$path = ((in_array($path[0], $system_classes, true) ? DIR_SYSTEM_CLASSES : DIR_CLASSES) . implode('/', $path));
36
+	$path = ((in_array($path[0], $system_classes, true) ? DIR_SYSTEM_CLASSES : DIR_CLASSES).implode('/', $path));
37 37
 
38 38
 	# Require class file
39 39
 
40
-	if (@file_exists($file_name = ($path . '.php')) && @is_file($file_name)) require_once $file_name;
40
+	if (@file_exists($file_name = ($path.'.php')) && @is_file($file_name)) require_once $file_name;
41 41
 
42
-	else if (@file_exists($file_name = ($path . '/' . $last . '.php')) && @is_file($file_name)) require_once $file_name;
42
+	else if (@file_exists($file_name = ($path.'/'.$last.'.php')) && @is_file($file_name)) require_once $file_name;
43 43
 
44 44
 	# Check if class exists
45 45
 
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/Utils/Menu.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,7 +20,9 @@  discard block
 block discarded – undo
20 20
 
21 21
 				$item->children = ($children = Template::group());
22 22
 
23
-				foreach ($this->menu[$id]['children'] as $child) $children->add($this->parseItem($child));
23
+				foreach ($this->menu[$id]['children'] as $child) {
24
+					$children->add($this->parseItem($child));
25
+				}
24 26
 
25 27
 			} else {
26 28
 
@@ -44,7 +46,9 @@  discard block
 block discarded – undo
44 46
 
45 47
 			$menu = Entitizer::treeview(TABLE_MENU)->subtree(0, ['active' => true]);
46 48
 
47
-			if (false !== $menu) $this->menu = $menu;
49
+			if (false !== $menu) {
50
+				$this->menu = $menu;
51
+			}
48 52
 		}
49 53
 
50 54
 		# Get block
@@ -53,7 +57,9 @@  discard block
 block discarded – undo
53 57
 
54 58
 			$menu = Template::group();
55 59
 
56
-			foreach ($this->menu[0]['children'] as $id) $menu->add($this->parseItem($id));
60
+			foreach ($this->menu[0]['children'] as $id) {
61
+				$menu->add($this->parseItem($id));
62
+			}
57 63
 
58 64
 			# ------------------------
59 65
 
Please login to merge, or discard this patch.
www/engine/System/Classes/Utils/Messages.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@  discard block
 block discarded – undo
21 21
 
22 22
 		public static function set(string $type, string $text, string $title = null) {
23 23
 
24
-			if (!in_array($type, static::$types, true) || isset(static::$items[$type]) || ('' === $text)) return;
24
+			if (!in_array($type, static::$types, true) || isset(static::$items[$type]) || ('' === $text)) {
25
+				return;
26
+			}
25 27
 
26 28
 			static::$items[$type] = ['text' => $text, 'title' => (('' !== $title) ? $title : null)];
27 29
 		}
@@ -45,7 +47,9 @@  discard block
 block discarded – undo
45 47
 
46 48
 				$block->type = $type; $block->text = Template::block($item['text']);
47 49
 
48
-				if (isset($item['title'])) $block->block('title')->set('text', $item['title'])->enable();
50
+				if (isset($item['title'])) {
51
+					$block->block('title')->set('text', $item['title'])->enable();
52
+				}
49 53
 			}
50 54
 
51 55
 			# ------------------------
Please login to merge, or discard this patch.
www/engine/System/Classes/Utils/Template/Variables.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,11 +14,15 @@
 block discarded – undo
14 14
 
15 15
 			$selection = ['name', 'value']; $order = ['name' => 'ASC'];
16 16
 
17
-			if (!(DB::select(TABLE_VARIABLES, $selection, null, $order) && DB::last()->status)) return;
17
+			if (!(DB::select(TABLE_VARIABLES, $selection, null, $order) && DB::last()->status)) {
18
+				return;
19
+			}
18 20
 
19 21
 			# Process results
20 22
 
21
-			while (null !== ($variable = DB::last()->row())) yield $variable['name'] => $variable['value'];
23
+			while (null !== ($variable = DB::last()->row())) {
24
+				yield $variable['name'] => $variable['value'];
25
+			}
22 26
 		}
23 27
 	}
24 28
 }
Please login to merge, or discard this patch.